{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# pandas 进阶修炼 ｜早起Python\n",
    "<br>\n",
    "\n",
    "**本习题由公众号【早起Python & 可视化图鉴】 原创，转载及其他形式合作请与我们联系（微信号`sshs321`)，未经授权严禁搬运及二次创作，侵权必究！**\n",
    "\n",
    "\n",
    "\n",
    "本习题基于 `pandas` 版本 `1.1.3`，所有内容应当在 `Jupyter Notebook` 中执行以获得最佳效果。\n",
    "\n",
    "不同版本之间写法可能会有少许不同，如若碰到此情况，你应该学会如何自行检索解决。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1 - 数据加载与存储 "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "是的，常常被忽略的「<font color=#E36C07>**数据加载与存储**</font>」也大有门道且值得作为本套习题的开门之章。\n",
    "\n",
    "在一次数据分析的过程中，你可能只会读取或存储一两次数据集。\n",
    "\n",
    "**但若能灵活掌握各项设置，在读取阶段就将数据筛选、匹配、格式指定等操作完成，有时会为我们节省大量时间。**\n",
    "\n",
    "在本节习题中，我将 pandas 数据分析中常见的数据读取与存储操作进行整理。\n",
    "\n",
    "<font color=#E36C07>**既可以用于巩固、学习各种操作，也可以作为速查手册使用**</font>。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 初始化\n",
    "\n",
    "<br>\n",
    "\n",
    "该 `Notebook` 版本为**纯习题版**\n",
    "\n",
    "如果需要答案或者提示，可以微信搜索公众号「早起Python」获取！"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1-1 数据读取"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1 读取 Excel 文件\n",
    "\n",
    "<br>\n",
    "\n",
    "- 读取当前目录下 `某招聘网站数据.csv` 文件\n",
    "\n",
    "- 读取当前目录下 `TOP250.xlsx` 文件\n",
    "\n",
    "**注意**：使用 `pandas` 读取 `CSV` 与 读取 `xlsx` 格式的 `Excel` 文件方法大致相同\n",
    "\n",
    "因此接下来与 `Excel` 相关的操作均以 `CSV` 格式进行出题。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "data = pd.read_csv(\"某招聘网站数据.csv\")\n",
    "data = pd.read_excel(\"TOP250.xlsx\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2 读取 Excel 文件｜指定位置\n",
    "\n",
    "在大多数情况下，我们会将 `notebook` 和数据源文件放在同一个目录（文件夹下），这样直接使用`pd.read_xxx(\"文件名\")`即可成功读取。\n",
    " \n",
    "但有时需要读取的文件和 `notebook` 不在同一个目录下，这时可以使用绝对路径或者相对本 `notebook` 的路径。\n",
    "\n",
    "现在请读取本套习题中第二章节下的数据，即 `2 - 个性化显示设置/data.csv`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd \n",
    "data=pd.read_csv('../2 - 个性化显示设置/data.csv')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "###  3 读取 Excel 文件｜指定行（顺序）\n",
    "<br>\n",
    "\n",
    "读取当前目录下 `某招聘网站数据.csv` 文件的 <font color = '#5F5FFC'>前20行</font>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "data=pd.read_csv('某招聘网站数据.csv').iloc[:20]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "###  4 读取 Excel 文件｜指定行（跳过）\n",
    "<br>\n",
    "\n",
    "读取当前目录下 `某招聘网站数据.csv` 文件并<font color = '#5F5FFC'>跳过前20行</font>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "data=pd.read_csv('某招聘网站数据.csv').iloc[20:]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "###  5 读取 Excel 文件｜指定行（条件）\n",
    "<br>\n",
    "\n",
    "读取当前目录下 `某招聘网站数据.csv` 文件中全部<font color = '#5F5FFC'>偶数行</font>\n",
    "\n",
    "思考：如果是读取全部奇数行，或者更多满足指定条件的行呢？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "# 奇数行\n",
    "data1=pd.read_csv('某招聘网站数据.csv').iloc[::2]\n",
    "# 偶数行\n",
    "data2=pd.read_csv('某招聘网站数据.csv').iloc[1::2]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 6 读取 Excel 文件｜指定列（列号）\n",
    "\n",
    "<br>\n",
    "\n",
    "**根据指定列号读取**\n",
    "\n",
    "读取当前目录下 `某招聘网站数据.csv` 文件的第 `1、3、5` 列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "data=pd.read_csv('某招聘网站数据.csv').iloc[[0,2,4]]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "###  7 读取 Excel 文件｜指定列（列名）\n",
    "\n",
    "<br>\n",
    "\n",
    "**根据指定列名读取**\n",
    "\n",
    "读取当前目录下 `某招聘网站数据.csv` 文件的 `positionId、positionName、salary` 列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "data=pd.read_csv('某招聘网站数据.csv').loc[:,['positionId','positionName','salary']]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "###  8 读取 Excel 文件｜指定列（匹配）\n",
    "\n",
    "<br>\n",
    "\n",
    "**根据指定列名匹配读取**\n",
    "\n",
    "让我们来个更难一点的，还是读取 `某招聘网站数据.csv` 文件，但现在有一个 list 中包含多个字段👇\n",
    "\n",
    "`usecols = ['positionId','test','positionName', 'test1','salary']`\n",
    "\n",
    "如果 `usecols` 中的列名存在于 `某招聘网站数据.csv` 中，则读取。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "usecols_list = ['positionId','test','positionName', 'test1','salary']\n",
    "# 方法一：读取时解决\n",
    "# data=pd.read_csv('某招聘网站数据.csv',usecols=lambda x: x in set(usecols_list))\n",
    "# 方法二：读取后解决\n",
    "df=pd.read_csv('某招聘网站数据.csv')\n",
    "usecols_list=[x for x in usecols_list if x in df.columns]\n",
    "print(usecols_list)\n",
    "res=df.loc[:,usecols_list]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 9 读取 Excel 文件｜指定索引\n",
    "\n",
    "<br>\n",
    "\n",
    "读取当前目录下 `某招聘网站数据.csv` 文件，并在读取时将 `positionId` 设置为索引列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "# 方法1：读取前设置索引\n",
    "df1=pd.read_csv('某招聘网站数据.csv',index_col='positionId')\n",
    "# 方法2：读取后设置索引\n",
    "df2=pd.read_csv('某招聘网站数据.csv')\n",
    "res_df=df2.set_index(keys='positionId')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "###  10 读取 Excel 文件｜指定标题\n",
    "\n",
    "<br>\n",
    "\n",
    "\n",
    "读取当前目录下 `某招聘网站数据.csv` 文件的 `positionId、positionName、salary` 列，并将标题设置为 `ID、岗位名称、薪资`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "# 方法1：读取前重设置标题（似乎比较麻烦，不友好）\n",
    "\n",
    "# 方法2：读取后重设置标题（主：rename返回值为空，不能进行链式调用）\n",
    "df2=pd.read_csv('某招聘网站数据.csv')\n",
    "df2.rename(columns={\n",
    "    'positionId':'ID',\n",
    "    'positionName':'岗位名称',\n",
    "    'salary':'薪资'\n",
    "},inplace=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "###  11 读取 Excel 文件｜缺失值转换\n",
    "\n",
    "<br>\n",
    "\n",
    "\n",
    "读取当前目录下 `某招聘网站数据.csv` 文件，**并不将缺失值标记为 `NA`**\n",
    "\n",
    "思考：为什么要这样做？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "    positionId         businessZones                linestaion\n",
      "0      6802721                ['仓前']                          \n",
      "1      5204912          ['西兴', '长河']                          \n",
      "2      6877668       ['四季青', '钱江新城']  4号线_城星路;4号线_市民中心;4号线_江锦路\n",
      "3      6496141                                         1号线_文泽路\n",
      "4      6467417                ['仓前']                          \n",
      "5      6882347                                                \n",
      "6      6841659                ['宁围']                          \n",
      "7      6764018  ['翠苑', '文一路', '古墩路']           2号线_古翠路;2号线_丰潭路\n",
      "8      6458372                                                \n",
      "9      6786904  ['翠苑', '文一路', '古墩路']           2号线_古翠路;2号线_丰潭路\n",
      "10     6804629                                                \n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "df=pd.read_csv('某招聘网站数据.csv', keep_default_na=False)\n",
    "print(df.loc[:10,['positionId','businessZones','linestaion','skillLables']])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "###  12 读取 Excel 文件｜缺失值标记\n",
    "\n",
    "<br>\n",
    "\n",
    "\n",
    "读取当前目录下 `某招聘网站数据.csv` 文件，**并将`[]`标记为缺失值**\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "    positionId         businessZones                linestaion  \\\n",
      "0      6802721                ['仓前']                       NaN   \n",
      "1      5204912          ['西兴', '长河']                       NaN   \n",
      "2      6877668       ['四季青', '钱江新城']  4号线_城星路;4号线_市民中心;4号线_江锦路   \n",
      "3      6496141                   NaN                   1号线_文泽路   \n",
      "4      6467417                ['仓前']                       NaN   \n",
      "5      6882347                   NaN                       NaN   \n",
      "6      6841659                ['宁围']                       NaN   \n",
      "7      6764018  ['翠苑', '文一路', '古墩路']           2号线_古翠路;2号线_丰潭路   \n",
      "8      6458372                   NaN                       NaN   \n",
      "9      6786904  ['翠苑', '文一路', '古墩路']           2号线_古翠路;2号线_丰潭路   \n",
      "10     6804629                   NaN                       NaN   \n",
      "\n",
      "                               skillLables  \n",
      "0             ['SQL', '数据库', '数据运营', 'BI']  \n",
      "1                           ['算法', '数据架构']  \n",
      "2                   ['数据库', '数据分析', 'SQL']  \n",
      "3                                      NaN  \n",
      "4                   ['BI', '数据分析', '数据运营']  \n",
      "5             ['BI', '可视化', '数据分析', '数据库']  \n",
      "6                                      NaN  \n",
      "7   ['Hadoop', 'Spark', 'MySQL', 'Oracle']  \n",
      "8                         ['数据分析', '数据运营']  \n",
      "9    ['Hive', '数据挖掘', '数据分析', 'SQLServer']  \n",
      "10                                ['数据分析']  \n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "df=pd.read_csv('某招聘网站数据.csv', na_values=['[]'])\n",
    "print(df.loc[:10,['positionId','businessZones','linestaion','skillLables']])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 13 读取 Excel 文件｜忽略缺失值\n",
    "\n",
    "<br>\n",
    "\n",
    "读取当前目录下 `某招聘网站数据.csv` 文件，**但不处理缺失值**\n",
    "\n",
    "思考：和之前的有什么不同，为什么这么做？\n",
    "\n",
    "【ai提示】\n",
    "了解 `na_filter` 与另外两个控制缺失值处理的参数的区别会更有帮助：\n",
    "\n",
    "| 参数 | 作用 | 适用场景 |\n",
    "| :--- | :--- | :--- |\n",
    "| **`na_filter=False`** | **完全禁用**缺失值识别，所有内容按原样读入。 | 需要绝对原始数据，后续自定义处理。 |\n",
    "| **`keep_default_na=False`** | 禁用Pandas默认的缺失值列表，但**仍可通过`na_values`自定义**缺失值。 | 仅不希望常见标记（如NA）被处理，但接受其他缺失值处理。 |\n",
    "| **`na_values=[...]`** | 自定义哪些字符串应被视为缺失值。 | 需要将特定值（如\"NULL\", \"未知\"）标记为缺失。 |"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   positionId positionName  companyId companySize industryField financeStage  \\\n",
      "0     6802721         数据分析     475770     50-150人      移动互联网,电商           A轮   \n",
      "1     5204912         数据建模      50735    150-500人            电商           B轮   \n",
      "2     6877668         数据分析     100125     2000人以上    移动互联网,企业服务         上市公司   \n",
      "3     6496141         数据分析      26564   500-2000人            电商        D轮及以上   \n",
      "4     6467417         数据分析      29211     2000人以上         物流丨运输         上市公司   \n",
      "\n",
      "                    companyLabelList  firstType secondType thirdType  ...  \\\n",
      "0   ['绩效奖金', '带薪年假', '定期体检', '弹性工作']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "1   ['年终奖金', '做五休二', '六险一金', '子女福利']  开发|测试|运维类       数据开发        建模  ...   \n",
      "2   ['节日礼物', '年底双薪', '股票期权', '带薪年假']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "3  ['生日趴', '每月腐败基金', '每月补贴', '年度旅游']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "4   ['技能培训', '免费班车', '专项奖金', '岗位晋升']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "\n",
      "  plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
      "0           0       0       0                                          \n",
      "1           0       0       0                                          \n",
      "2           0       0       0                                          \n",
      "3           0       0       0                                          \n",
      "4           0       0       0                                          \n",
      "\n",
      "  isHotHire  count aggregatePositionIds famousCompany  \n",
      "0         0      0                   []         False  \n",
      "1         0      0                   []         False  \n",
      "2         0      0                   []         False  \n",
      "3         0      0                   []          True  \n",
      "4         0      0                   []          True  \n",
      "\n",
      "[5 rows x 52 columns]\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "# 读取CSV文件，不进行任何缺失值处理\n",
    "df = pd.read_csv('某招聘网站数据.csv', na_filter=False)\n",
    "\n",
    "# 查看数据前几行，确认原始值被保留\n",
    "print(df.head())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 14 读取 Excel 文件｜指定格式\n",
    "\n",
    "<br>\n",
    "\n",
    "读取当前目录下 `某招聘网站数据.csv` 文件，并将 `positionId,companyId` 设置为字符串格式"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  positionId positionName companyId companySize industryField financeStage  \\\n",
      "0    6802721         数据分析    475770     50-150人      移动互联网,电商           A轮   \n",
      "1    5204912         数据建模     50735    150-500人            电商           B轮   \n",
      "2    6877668         数据分析    100125     2000人以上    移动互联网,企业服务         上市公司   \n",
      "3    6496141         数据分析     26564   500-2000人            电商        D轮及以上   \n",
      "4    6467417         数据分析     29211     2000人以上         物流丨运输         上市公司   \n",
      "\n",
      "                    companyLabelList  firstType secondType thirdType  ...  \\\n",
      "0   ['绩效奖金', '带薪年假', '定期体检', '弹性工作']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "1   ['年终奖金', '做五休二', '六险一金', '子女福利']  开发|测试|运维类       数据开发        建模  ...   \n",
      "2   ['节日礼物', '年底双薪', '股票期权', '带薪年假']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "3  ['生日趴', '每月腐败基金', '每月补贴', '年度旅游']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "4   ['技能培训', '免费班车', '专项奖金', '岗位晋升']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "\n",
      "  plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
      "0  NaN      0       0       0              NaN                   NaN   \n",
      "1  NaN      0       0       0              NaN                   NaN   \n",
      "2  NaN      0       0       0              NaN                   NaN   \n",
      "3  NaN      0       0       0              NaN                   NaN   \n",
      "4  NaN      0       0       0              NaN                   NaN   \n",
      "\n",
      "  isHotHire  count aggregatePositionIds famousCompany  \n",
      "0         0      0                   []         False  \n",
      "1         0      0                   []         False  \n",
      "2         0      0                   []         False  \n",
      "3         0      0                   []          True  \n",
      "4         0      0                   []          True  \n",
      "\n",
      "[5 rows x 52 columns]\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "df = pd.read_csv(\n",
    "    '某招聘网站数据.csv',\n",
    "    dtype={'positionId':str,'companyId':str}\n",
    ")\n",
    "print(df.head())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 15 读取 Excel 文件｜指定格式（时间）\n",
    "\n",
    "<br>\n",
    "\n",
    "读取当前目录下 `某招聘网站数据.csv` 文件，并将 `createTime` 列设置为字符串格式"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   positionId positionName  companyId companySize industryField financeStage  \\\n",
      "0     6802721         数据分析     475770     50-150人      移动互联网,电商           A轮   \n",
      "1     5204912         数据建模      50735    150-500人            电商           B轮   \n",
      "2     6877668         数据分析     100125     2000人以上    移动互联网,企业服务         上市公司   \n",
      "3     6496141         数据分析      26564   500-2000人            电商        D轮及以上   \n",
      "4     6467417         数据分析      29211     2000人以上         物流丨运输         上市公司   \n",
      "\n",
      "                    companyLabelList  firstType secondType thirdType  ...  \\\n",
      "0   ['绩效奖金', '带薪年假', '定期体检', '弹性工作']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "1   ['年终奖金', '做五休二', '六险一金', '子女福利']  开发|测试|运维类       数据开发        建模  ...   \n",
      "2   ['节日礼物', '年底双薪', '股票期权', '带薪年假']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "3  ['生日趴', '每月腐败基金', '每月补贴', '年度旅游']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "4   ['技能培训', '免费班车', '专项奖金', '岗位晋升']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "\n",
      "  plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
      "0  NaN      0       0       0              NaN                   NaN   \n",
      "1  NaN      0       0       0              NaN                   NaN   \n",
      "2  NaN      0       0       0              NaN                   NaN   \n",
      "3  NaN      0       0       0              NaN                   NaN   \n",
      "4  NaN      0       0       0              NaN                   NaN   \n",
      "\n",
      "  isHotHire  count aggregatePositionIds famousCompany  \n",
      "0         0      0                   []         False  \n",
      "1         0      0                   []         False  \n",
      "2         0      0                   []         False  \n",
      "3         0      0                   []          True  \n",
      "4         0      0                   []          True  \n",
      "\n",
      "[5 rows x 52 columns]\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "df = pd.read_csv(\n",
    "    '某招聘网站数据.csv',\n",
    "    dtype={'createTime':str}\n",
    ")\n",
    "print(df.head())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 16 读取 Excel 文件｜分块读取\n",
    "\n",
    "\n",
    "<br>\n",
    "\n",
    "读取当前目录下 `某招聘网站数据.csv` 文件，要求返回一个可迭代对象，每次读取 10 行\n",
    "\n",
    "思考：为什么这样做？\n",
    "【ai说明】两种方法的比较\n",
    "\n",
    "| 方法 | 优点 | 缺点 | 适用场景 |\n",
    "|------|------|------|----------|\n",
    "| `chunksize` | 简单直接，自动分块 | 分块大小固定 | 大多数常规分块读取场景 |\n",
    "| `iterator=True` | 灵活，可动态调整分块大小 | 需要手动调用get_chunk() | 需要可变分块大小的复杂场景 |"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=== 方法1：使用chunksize参数 ===\n",
      "第1个数据块，形状: (10, 52)\n",
      "数据类型:\n",
      "positionId                object\n",
      "positionName              object\n",
      "companyId                 object\n",
      "companySize               object\n",
      "industryField             object\n",
      "financeStage              object\n",
      "companyLabelList          object\n",
      "firstType                 object\n",
      "secondType                object\n",
      "thirdType                 object\n",
      "skillLables               object\n",
      "positionLables            object\n",
      "industryLables            object\n",
      "createTime                object\n",
      "formatCreateTime          object\n",
      "district                  object\n",
      "businessZones             object\n",
      "salary                     int64\n",
      "workYear                  object\n",
      "jobNature                 object\n",
      "education                 object\n",
      "positionAdvantage         object\n",
      "imState                   object\n",
      "lastLogin                 object\n",
      "publisherId                int64\n",
      "approve                    int64\n",
      "subwayline                object\n",
      "stationname               object\n",
      "linestaion                object\n",
      "latitude                 float64\n",
      "longitude                float64\n",
      "hitags                   float64\n",
      "resumeProcessRate          int64\n",
      "resumeProcessDay           int64\n",
      "score                      int64\n",
      "newScore                   int64\n",
      "matchScore               float64\n",
      "matchScoreExplain        float64\n",
      "query                    float64\n",
      "explain                  float64\n",
      "isSchoolJob                int64\n",
      "adWord                     int64\n",
      "plus                     float64\n",
      "pcShow                     int64\n",
      "appShow                    int64\n",
      "deliver                    int64\n",
      "gradeDescription         float64\n",
      "promotionScoreExplain    float64\n",
      "isHotHire                  int64\n",
      "count                      int64\n",
      "aggregatePositionIds      object\n",
      "famousCompany               bool\n",
      "dtype: object\n",
      "前几行数据:\n",
      "  positionId positionName companyId companySize industryField financeStage  \\\n",
      "0    6802721         数据分析    475770     50-150人      移动互联网,电商           A轮   \n",
      "1    5204912         数据建模     50735    150-500人            电商           B轮   \n",
      "2    6877668         数据分析    100125     2000人以上    移动互联网,企业服务         上市公司   \n",
      "3    6496141         数据分析     26564   500-2000人            电商        D轮及以上   \n",
      "4    6467417         数据分析     29211     2000人以上         物流丨运输         上市公司   \n",
      "\n",
      "                    companyLabelList  firstType secondType thirdType  ...  \\\n",
      "0   ['绩效奖金', '带薪年假', '定期体检', '弹性工作']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "1   ['年终奖金', '做五休二', '六险一金', '子女福利']  开发|测试|运维类       数据开发        建模  ...   \n",
      "2   ['节日礼物', '年底双薪', '股票期权', '带薪年假']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "3  ['生日趴', '每月腐败基金', '每月补贴', '年度旅游']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "4   ['技能培训', '免费班车', '专项奖金', '岗位晋升']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "\n",
      "  plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
      "0  NaN      0       0       0              NaN                   NaN   \n",
      "1  NaN      0       0       0              NaN                   NaN   \n",
      "2  NaN      0       0       0              NaN                   NaN   \n",
      "3  NaN      0       0       0              NaN                   NaN   \n",
      "4  NaN      0       0       0              NaN                   NaN   \n",
      "\n",
      "  isHotHire  count aggregatePositionIds famousCompany  \n",
      "0         0      0                   []         False  \n",
      "1         0      0                   []         False  \n",
      "2         0      0                   []         False  \n",
      "3         0      0                   []          True  \n",
      "4         0      0                   []          True  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "第2个数据块，形状: (10, 52)\n",
      "数据类型:\n",
      "positionId                object\n",
      "positionName              object\n",
      "companyId                 object\n",
      "companySize               object\n",
      "industryField             object\n",
      "financeStage              object\n",
      "companyLabelList          object\n",
      "firstType                 object\n",
      "secondType                object\n",
      "thirdType                 object\n",
      "skillLables               object\n",
      "positionLables            object\n",
      "industryLables            object\n",
      "createTime                object\n",
      "formatCreateTime          object\n",
      "district                  object\n",
      "businessZones             object\n",
      "salary                     int64\n",
      "workYear                  object\n",
      "jobNature                 object\n",
      "education                 object\n",
      "positionAdvantage         object\n",
      "imState                   object\n",
      "lastLogin                 object\n",
      "publisherId                int64\n",
      "approve                    int64\n",
      "subwayline                object\n",
      "stationname               object\n",
      "linestaion                object\n",
      "latitude                 float64\n",
      "longitude                float64\n",
      "hitags                    object\n",
      "resumeProcessRate          int64\n",
      "resumeProcessDay           int64\n",
      "score                      int64\n",
      "newScore                   int64\n",
      "matchScore               float64\n",
      "matchScoreExplain        float64\n",
      "query                    float64\n",
      "explain                  float64\n",
      "isSchoolJob                int64\n",
      "adWord                     int64\n",
      "plus                     float64\n",
      "pcShow                     int64\n",
      "appShow                    int64\n",
      "deliver                    int64\n",
      "gradeDescription         float64\n",
      "promotionScoreExplain    float64\n",
      "isHotHire                  int64\n",
      "count                      int64\n",
      "aggregatePositionIds      object\n",
      "famousCompany               bool\n",
      "dtype: object\n",
      "前几行数据:\n",
      "   positionId      positionName companyId companySize industryField  \\\n",
      "10    6804629             数据分析师     34132    150-500人     数据服务,广告营销   \n",
      "11    6847013  大数据分析工程师(J11108)     55046     2000人以上    移动互联网,企业服务   \n",
      "12    6763962           数据分析工程师     13163   500-2000人         移动互联网   \n",
      "13    6804489           资深数据分析师     34132    150-500人     数据服务,广告营销   \n",
      "14    6657285             数据分析师      7461     2000人以上          企业服务   \n",
      "\n",
      "   financeStage                     companyLabelList  firstType secondType  \\\n",
      "10           A轮  ['开放式办公', '扁平管理', '带薪假期', '弹性工作时间']  产品|需求|项目类       数据分析   \n",
      "11         上市公司     ['技能培训', '年底双薪', '带薪年假', '岗位晋升']  开发|测试|运维类       数据开发   \n",
      "12         上市公司     ['绩效奖金', '股票期权', '年底双薪', '专项奖金']  开发|测试|运维类       数据开发   \n",
      "13           A轮  ['开放式办公', '扁平管理', '带薪假期', '弹性工作时间']  开发|测试|运维类       数据开发   \n",
      "14         上市公司   ['工程师氛围', '弹性工作', '扁平管理', '上班不打卡']  产品|需求|项目类       数据分析   \n",
      "\n",
      "   thirdType  ... plus pcShow appShow deliver gradeDescription  \\\n",
      "10      数据分析  ...  NaN      0       0       0              NaN   \n",
      "11      数据分析  ...  NaN      0       0       0              NaN   \n",
      "12      数据分析  ...  NaN      0       0       0              NaN   \n",
      "13      数据分析  ...  NaN      0       0       0              NaN   \n",
      "14      数据分析  ...  NaN      0       0       0              NaN   \n",
      "\n",
      "   promotionScoreExplain isHotHire  count aggregatePositionIds famousCompany  \n",
      "10                   NaN         0      0                   []         False  \n",
      "11                   NaN         0      0                   []         False  \n",
      "12                   NaN         0      0                   []          True  \n",
      "13                   NaN         0      0                   []         False  \n",
      "14                   NaN         0      0                   []          True  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "第3个数据块，形状: (10, 52)\n",
      "数据类型:\n",
      "positionId                object\n",
      "positionName              object\n",
      "companyId                 object\n",
      "companySize               object\n",
      "industryField             object\n",
      "financeStage              object\n",
      "companyLabelList          object\n",
      "firstType                 object\n",
      "secondType                object\n",
      "thirdType                 object\n",
      "skillLables               object\n",
      "positionLables            object\n",
      "industryLables            object\n",
      "createTime                object\n",
      "formatCreateTime          object\n",
      "district                  object\n",
      "businessZones             object\n",
      "salary                     int64\n",
      "workYear                  object\n",
      "jobNature                 object\n",
      "education                 object\n",
      "positionAdvantage         object\n",
      "imState                   object\n",
      "lastLogin                 object\n",
      "publisherId                int64\n",
      "approve                    int64\n",
      "subwayline                object\n",
      "stationname               object\n",
      "linestaion                object\n",
      "latitude                 float64\n",
      "longitude                float64\n",
      "hitags                   float64\n",
      "resumeProcessRate          int64\n",
      "resumeProcessDay           int64\n",
      "score                      int64\n",
      "newScore                   int64\n",
      "matchScore               float64\n",
      "matchScoreExplain        float64\n",
      "query                    float64\n",
      "explain                  float64\n",
      "isSchoolJob                int64\n",
      "adWord                     int64\n",
      "plus                     float64\n",
      "pcShow                     int64\n",
      "appShow                    int64\n",
      "deliver                    int64\n",
      "gradeDescription         float64\n",
      "promotionScoreExplain    float64\n",
      "isHotHire                  int64\n",
      "count                      int64\n",
      "aggregatePositionIds      object\n",
      "famousCompany               bool\n",
      "dtype: object\n",
      "前几行数据:\n",
      "   positionId positionName companyId companySize industryField financeStage  \\\n",
      "20    6829277      资深数据分析师       593     2000人以上      移动互联网,游戏        不需要融资   \n",
      "21    6267370       数据分析专家     31544    150-500人          数据服务        不需要融资   \n",
      "22    5927901       数据分析经理        62     2000人以上         文娱丨内容           C轮   \n",
      "23    6862245       数据分析专家    473950     50-150人         移动互联网          未融资   \n",
      "24    5604926        数据分析师    143884     50-150人      移动互联网,金融           A轮   \n",
      "\n",
      "                        companyLabelList  firstType secondType thirdType  ...  \\\n",
      "20      ['五险一金', '交通补助', '绩效奖金', '节日礼物']  产品|需求|项目类     高端产品职位    数据分析专家  ...   \n",
      "21    ['专业红娘牵线', '节日礼物', '技能培训', '岗位晋升']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "22  ['扁平管理', '弹性工作', '大厨定制三餐', '就近租房补贴']  产品|需求|项目类       产品经理    其他产品经理  ...   \n",
      "23                                    []  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "24      ['股票期权', '带薪年假', '绩效奖金', '年底双薪']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "\n",
      "   plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
      "20  NaN      0       0       0              NaN                   NaN   \n",
      "21  NaN      0       0       0              NaN                   NaN   \n",
      "22  NaN      0       0       0              NaN                   NaN   \n",
      "23  NaN      0       0       0              NaN                   NaN   \n",
      "24  NaN      0       0       0              NaN                   NaN   \n",
      "\n",
      "   isHotHire  count aggregatePositionIds famousCompany  \n",
      "20         0      0                   []          True  \n",
      "21         0      0                   []         False  \n",
      "22         0      0                   []          True  \n",
      "23         0      0                   []         False  \n",
      "24         0      0                   []         False  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "第4个数据块，形状: (10, 52)\n",
      "数据类型:\n",
      "positionId                object\n",
      "positionName              object\n",
      "companyId                 object\n",
      "companySize               object\n",
      "industryField             object\n",
      "financeStage              object\n",
      "companyLabelList          object\n",
      "firstType                 object\n",
      "secondType                object\n",
      "thirdType                 object\n",
      "skillLables               object\n",
      "positionLables            object\n",
      "industryLables            object\n",
      "createTime                object\n",
      "formatCreateTime          object\n",
      "district                  object\n",
      "businessZones             object\n",
      "salary                     int64\n",
      "workYear                  object\n",
      "jobNature                 object\n",
      "education                 object\n",
      "positionAdvantage         object\n",
      "imState                   object\n",
      "lastLogin                 object\n",
      "publisherId                int64\n",
      "approve                    int64\n",
      "subwayline                object\n",
      "stationname               object\n",
      "linestaion                object\n",
      "latitude                 float64\n",
      "longitude                float64\n",
      "hitags                   float64\n",
      "resumeProcessRate          int64\n",
      "resumeProcessDay           int64\n",
      "score                      int64\n",
      "newScore                   int64\n",
      "matchScore               float64\n",
      "matchScoreExplain        float64\n",
      "query                    float64\n",
      "explain                  float64\n",
      "isSchoolJob                int64\n",
      "adWord                     int64\n",
      "plus                     float64\n",
      "pcShow                     int64\n",
      "appShow                    int64\n",
      "deliver                    int64\n",
      "gradeDescription         float64\n",
      "promotionScoreExplain    float64\n",
      "isHotHire                  int64\n",
      "count                      int64\n",
      "aggregatePositionIds      object\n",
      "famousCompany               bool\n",
      "dtype: object\n",
      "前几行数据:\n",
      "   positionId positionName companyId companySize industryField financeStage  \\\n",
      "30    6234992        数据分析师       542   500-2000人          消费生活        D轮及以上   \n",
      "31    6758467      店铺数据分析师     80863    150-500人      移动互联网,电商           B轮   \n",
      "32    6804489      资深数据分析师     34132    150-500人     数据服务,广告营销           A轮   \n",
      "33    6764017    数据分析师（社招）     13163   500-2000人         移动互联网         上市公司   \n",
      "34    6228290      商业数据分析师    509360     50-150人    移动互联网,企业服务           B轮   \n",
      "\n",
      "                       companyLabelList  firstType secondType thirdType  ...  \\\n",
      "30     ['六险一金', '快乐高效文化', '绩效奖金', '信任']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "31     ['技能培训', '带薪年假', '绩效奖金', '岗位晋升']     市场|商务类      市场|营销    商业数据分析  ...   \n",
      "32  ['开放式办公', '扁平管理', '带薪假期', '弹性工作时间']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "33     ['绩效奖金', '股票期权', '年底双薪', '专项奖金']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "34        ['定期体检', '帅哥多', '领导好', '美女多']     市场|商务类      市场|营销    商业数据分析  ...   \n",
      "\n",
      "   plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
      "30  NaN      0       0       0              NaN                   NaN   \n",
      "31  NaN      0       0       0              NaN                   NaN   \n",
      "32  NaN      0       0       0              NaN                   NaN   \n",
      "33  NaN      0       0       0              NaN                   NaN   \n",
      "34  NaN      0       0       0              NaN                   NaN   \n",
      "\n",
      "   isHotHire  count aggregatePositionIds famousCompany  \n",
      "30         0      0                   []          True  \n",
      "31         0      0                   []         False  \n",
      "32         0      0                   []         False  \n",
      "33         0      0                   []          True  \n",
      "34         0      0                   []         False  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "第5个数据块，形状: (10, 52)\n",
      "数据类型:\n",
      "positionId                object\n",
      "positionName              object\n",
      "companyId                 object\n",
      "companySize               object\n",
      "industryField             object\n",
      "financeStage              object\n",
      "companyLabelList          object\n",
      "firstType                 object\n",
      "secondType                object\n",
      "thirdType                 object\n",
      "skillLables               object\n",
      "positionLables            object\n",
      "industryLables            object\n",
      "createTime                object\n",
      "formatCreateTime          object\n",
      "district                  object\n",
      "businessZones             object\n",
      "salary                     int64\n",
      "workYear                  object\n",
      "jobNature                 object\n",
      "education                 object\n",
      "positionAdvantage         object\n",
      "imState                   object\n",
      "lastLogin                 object\n",
      "publisherId                int64\n",
      "approve                    int64\n",
      "subwayline                object\n",
      "stationname               object\n",
      "linestaion                object\n",
      "latitude                 float64\n",
      "longitude                float64\n",
      "hitags                   float64\n",
      "resumeProcessRate          int64\n",
      "resumeProcessDay           int64\n",
      "score                      int64\n",
      "newScore                   int64\n",
      "matchScore               float64\n",
      "matchScoreExplain        float64\n",
      "query                    float64\n",
      "explain                  float64\n",
      "isSchoolJob                int64\n",
      "adWord                     int64\n",
      "plus                     float64\n",
      "pcShow                     int64\n",
      "appShow                    int64\n",
      "deliver                    int64\n",
      "gradeDescription         float64\n",
      "promotionScoreExplain    float64\n",
      "isHotHire                  int64\n",
      "count                      int64\n",
      "aggregatePositionIds      object\n",
      "famousCompany               bool\n",
      "dtype: object\n",
      "前几行数据:\n",
      "   positionId positionName companyId companySize industryField financeStage  \\\n",
      "40    6791055      高级数据分析师    432882    150-500人         移动互联网        不需要融资   \n",
      "41    6869123  数据分析师（财务方向）    173746    150-500人          消费生活           C轮   \n",
      "42    6344146      资深数据分析师    522865    150-500人            游戏        不需要融资   \n",
      "43    5921220      财务数据分析师    137388    150-500人      移动互联网,电商        不需要融资   \n",
      "44    6653757      银行数据分析岗     23403     2000人以上          企业服务         上市公司   \n",
      "\n",
      "                      companyLabelList  firstType secondType thirdType  ...  \\\n",
      "40  ['技术大牛', '领导nice', '帅哥美女', '环境超棒']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "41                                  []  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "42    ['年底双薪', '专项奖金', '提供三餐', '便捷班车']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "43    ['年终分红', '绩效奖金', '定期体检', '年底双薪']  综合职能|高级管理         财务      财务风控  ...   \n",
      "44    ['五险一金', '通讯津贴', '带薪年假', '定期体检']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "\n",
      "   plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
      "40  NaN      0       0       0              NaN                   NaN   \n",
      "41  NaN      0       0       0              NaN                   NaN   \n",
      "42  NaN      0       0       0              NaN                   NaN   \n",
      "43  NaN      0       0       0              NaN                   NaN   \n",
      "44  NaN      0       0       0              NaN                   NaN   \n",
      "\n",
      "   isHotHire  count aggregatePositionIds famousCompany  \n",
      "40         0      0                   []         False  \n",
      "41         0      0                   []         False  \n",
      "42         0      0                   []         False  \n",
      "43         0      0                   []         False  \n",
      "44         0      0                   []         False  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "第6个数据块，形状: (10, 52)\n",
      "数据类型:\n",
      "positionId                object\n",
      "positionName              object\n",
      "companyId                 object\n",
      "companySize               object\n",
      "industryField             object\n",
      "financeStage              object\n",
      "companyLabelList          object\n",
      "firstType                 object\n",
      "secondType                object\n",
      "thirdType                 object\n",
      "skillLables               object\n",
      "positionLables            object\n",
      "industryLables            object\n",
      "createTime                object\n",
      "formatCreateTime          object\n",
      "district                  object\n",
      "businessZones             object\n",
      "salary                     int64\n",
      "workYear                  object\n",
      "jobNature                 object\n",
      "education                 object\n",
      "positionAdvantage         object\n",
      "imState                   object\n",
      "lastLogin                 object\n",
      "publisherId                int64\n",
      "approve                    int64\n",
      "subwayline                object\n",
      "stationname               object\n",
      "linestaion                object\n",
      "latitude                 float64\n",
      "longitude                float64\n",
      "hitags                   float64\n",
      "resumeProcessRate          int64\n",
      "resumeProcessDay           int64\n",
      "score                      int64\n",
      "newScore                   int64\n",
      "matchScore               float64\n",
      "matchScoreExplain        float64\n",
      "query                    float64\n",
      "explain                  float64\n",
      "isSchoolJob                int64\n",
      "adWord                     int64\n",
      "plus                     float64\n",
      "pcShow                     int64\n",
      "appShow                    int64\n",
      "deliver                    int64\n",
      "gradeDescription         float64\n",
      "promotionScoreExplain    float64\n",
      "isHotHire                  int64\n",
      "count                      int64\n",
      "aggregatePositionIds      object\n",
      "famousCompany               bool\n",
      "dtype: object\n",
      "前几行数据:\n",
      "   positionId      positionName companyId companySize industryField  \\\n",
      "50    6680900  数据分析师 (MJ000250)    114335    150-500人          数据服务   \n",
      "51    6191993   数据分析专家03-10-217     18655     2000人以上         汽车丨出行   \n",
      "52    6486069      解决方案顾问/数据分析师    166666    150-500人     企业服务,数据服务   \n",
      "53    6814233             数据分析师    619746     2000人以上            教育   \n",
      "54    6046775            数据分析专家    133429     50-150人    移动互联网,消费生活   \n",
      "\n",
      "   financeStage                  companyLabelList  firstType secondType  \\\n",
      "50           B轮   ['股票期权', '弹性工作', '领导好', '五险一金']  产品|需求|项目类       产品经理   \n",
      "51        D轮及以上    ['技能培训', 'Geek', '开放', '扁平管理']  开发|测试|运维类       数据开发   \n",
      "52           B轮  ['股票期权', '绩效奖金', '带薪年假', '弹性工作']  产品|需求|项目类       数据分析   \n",
      "53         上市公司  ['绩效奖金', '定期体检', '提供宿舍', '管理规范']  产品|需求|项目类       数据分析   \n",
      "54          未融资   ['年底双薪', '专项奖金', '美女多', '弹性工作']  产品|需求|项目类     高端产品职位   \n",
      "\n",
      "   thirdType  ... plus pcShow appShow deliver gradeDescription  \\\n",
      "50     数据分析师  ...  NaN      0       0       0              NaN   \n",
      "51      数据分析  ...  NaN      0       0       0              NaN   \n",
      "52      数据分析  ...  NaN      0       0       0              NaN   \n",
      "53      数据分析  ...  NaN      0       0       0              NaN   \n",
      "54    数据分析专家  ...  NaN      0       0       0              NaN   \n",
      "\n",
      "   promotionScoreExplain isHotHire  count aggregatePositionIds famousCompany  \n",
      "50                   NaN         0      0                   []         False  \n",
      "51                   NaN         0      0                   []          True  \n",
      "52                   NaN         0      0                   []         False  \n",
      "53                   NaN         0      0                   []         False  \n",
      "54                   NaN         0      0                   []         False  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "第7个数据块，形状: (10, 52)\n",
      "数据类型:\n",
      "positionId                object\n",
      "positionName              object\n",
      "companyId                 object\n",
      "companySize               object\n",
      "industryField             object\n",
      "financeStage              object\n",
      "companyLabelList          object\n",
      "firstType                 object\n",
      "secondType                object\n",
      "thirdType                 object\n",
      "skillLables               object\n",
      "positionLables            object\n",
      "industryLables            object\n",
      "createTime                object\n",
      "formatCreateTime          object\n",
      "district                  object\n",
      "businessZones             object\n",
      "salary                     int64\n",
      "workYear                  object\n",
      "jobNature                 object\n",
      "education                 object\n",
      "positionAdvantage         object\n",
      "imState                   object\n",
      "lastLogin                 object\n",
      "publisherId                int64\n",
      "approve                    int64\n",
      "subwayline               float64\n",
      "stationname              float64\n",
      "linestaion               float64\n",
      "latitude                 float64\n",
      "longitude                float64\n",
      "hitags                   float64\n",
      "resumeProcessRate          int64\n",
      "resumeProcessDay           int64\n",
      "score                      int64\n",
      "newScore                   int64\n",
      "matchScore               float64\n",
      "matchScoreExplain        float64\n",
      "query                    float64\n",
      "explain                  float64\n",
      "isSchoolJob                int64\n",
      "adWord                     int64\n",
      "plus                     float64\n",
      "pcShow                     int64\n",
      "appShow                    int64\n",
      "deliver                    int64\n",
      "gradeDescription         float64\n",
      "promotionScoreExplain    float64\n",
      "isHotHire                  int64\n",
      "count                      int64\n",
      "aggregatePositionIds      object\n",
      "famousCompany               bool\n",
      "dtype: object\n",
      "前几行数据:\n",
      "   positionId       positionName companyId companySize industryField  \\\n",
      "60    5978750  数据分析师（保险）13-01-19     18655     2000人以上         汽车丨出行   \n",
      "61    5990647          高级财务数据分析师     18655     2000人以上         汽车丨出行   \n",
      "62    6191993    数据分析专家03-10-217     18655     2000人以上         汽车丨出行   \n",
      "63    6680900   数据分析师 (MJ000250)    114335    150-500人          数据服务   \n",
      "64    6789831            数据分析实习生    306282    150-500人    移动互联网,数据服务   \n",
      "\n",
      "   financeStage                  companyLabelList  firstType secondType  \\\n",
      "60        D轮及以上    ['技能培训', 'Geek', '开放', '扁平管理']  开发|测试|运维类       数据开发   \n",
      "61        D轮及以上    ['技能培训', 'Geek', '开放', '扁平管理']  综合职能|高级管理         财务   \n",
      "62        D轮及以上    ['技能培训', 'Geek', '开放', '扁平管理']  开发|测试|运维类       数据开发   \n",
      "63           B轮   ['股票期权', '弹性工作', '领导好', '五险一金']  产品|需求|项目类       产品经理   \n",
      "64          未融资  ['弹性工作', '技能培训', '岗位晋升', '五险一金']  开发|测试|运维类       数据开发   \n",
      "\n",
      "   thirdType  ... plus pcShow appShow deliver gradeDescription  \\\n",
      "60      数据分析  ...  NaN      0       0       0              NaN   \n",
      "61        财务  ...  NaN      0       0       0              NaN   \n",
      "62      数据分析  ...  NaN      0       0       0              NaN   \n",
      "63     数据分析师  ...  NaN      0       0       0              NaN   \n",
      "64      数据分析  ...  NaN      0       0       0              NaN   \n",
      "\n",
      "   promotionScoreExplain isHotHire  count aggregatePositionIds famousCompany  \n",
      "60                   NaN         0      0                   []          True  \n",
      "61                   NaN         0      0                   []          True  \n",
      "62                   NaN         0      0                   []          True  \n",
      "63                   NaN         0      0                   []         False  \n",
      "64                   NaN         0      0                   []         False  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "第8个数据块，形状: (10, 52)\n",
      "数据类型:\n",
      "positionId                object\n",
      "positionName              object\n",
      "companyId                 object\n",
      "companySize               object\n",
      "industryField             object\n",
      "financeStage              object\n",
      "companyLabelList          object\n",
      "firstType                 object\n",
      "secondType                object\n",
      "thirdType                 object\n",
      "skillLables               object\n",
      "positionLables            object\n",
      "industryLables            object\n",
      "createTime                object\n",
      "formatCreateTime          object\n",
      "district                  object\n",
      "businessZones             object\n",
      "salary                     int64\n",
      "workYear                  object\n",
      "jobNature                 object\n",
      "education                 object\n",
      "positionAdvantage         object\n",
      "imState                   object\n",
      "lastLogin                 object\n",
      "publisherId                int64\n",
      "approve                    int64\n",
      "subwayline                object\n",
      "stationname               object\n",
      "linestaion                object\n",
      "latitude                 float64\n",
      "longitude                float64\n",
      "hitags                   float64\n",
      "resumeProcessRate          int64\n",
      "resumeProcessDay           int64\n",
      "score                      int64\n",
      "newScore                   int64\n",
      "matchScore               float64\n",
      "matchScoreExplain        float64\n",
      "query                    float64\n",
      "explain                  float64\n",
      "isSchoolJob                int64\n",
      "adWord                     int64\n",
      "plus                     float64\n",
      "pcShow                     int64\n",
      "appShow                    int64\n",
      "deliver                    int64\n",
      "gradeDescription         float64\n",
      "promotionScoreExplain    float64\n",
      "isHotHire                  int64\n",
      "count                      int64\n",
      "aggregatePositionIds      object\n",
      "famousCompany               bool\n",
      "dtype: object\n",
      "前几行数据:\n",
      "   positionId  positionName companyId companySize industryField financeStage  \\\n",
      "70    6728610      高级数据分析专员     98316     2000人以上       电商,消费生活         上市公司   \n",
      "71    6793844       BI数据分析师    555182     50-150人      移动互联网,电商          天使轮   \n",
      "72    6794326       BI数据分析师    374014   500-2000人      移动互联网,金融           B轮   \n",
      "73    6819289         数据分析师     28103     2000人以上       消费生活,硬件         上市公司   \n",
      "74    6837340  数据分析-2020届春招    205347     2000人以上         金融,电商         上市公司   \n",
      "\n",
      "                      companyLabelList  firstType secondType thirdType  ...  \\\n",
      "70    ['午餐补助', '带薪年假', '定期体检', '年度旅游']     市场|商务类      市场|营销    商业数据分析  ...   \n",
      "71                                  []  运营|编辑|客服类         运营        运营  ...   \n",
      "72     ['弹性工作', '扁平管理', '领导好', '五险一金']  产品|需求|项目类       数据分析        BI  ...   \n",
      "73  ['定期体检', '五险一金', '专项奖金', '骨干家庭公寓']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "74     ['带薪年假', '定期体检', '免费班车', '领导好']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "\n",
      "   plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
      "70  NaN      0       0       0              NaN                   NaN   \n",
      "71  NaN      0       0       0              NaN                   NaN   \n",
      "72  NaN      0       0       0              NaN                   NaN   \n",
      "73  NaN      0       0       0              NaN                   NaN   \n",
      "74  NaN      0       0       0              NaN                   NaN   \n",
      "\n",
      "   isHotHire  count aggregatePositionIds famousCompany  \n",
      "70         0      0                   []         False  \n",
      "71         0      0                   []         False  \n",
      "72         0      0                   []         False  \n",
      "73         0      0                   []          True  \n",
      "74         0      0                   []          True  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "第9个数据块，形状: (10, 52)\n",
      "数据类型:\n",
      "positionId                object\n",
      "positionName              object\n",
      "companyId                 object\n",
      "companySize               object\n",
      "industryField             object\n",
      "financeStage              object\n",
      "companyLabelList          object\n",
      "firstType                 object\n",
      "secondType                object\n",
      "thirdType                 object\n",
      "skillLables               object\n",
      "positionLables            object\n",
      "industryLables            object\n",
      "createTime                object\n",
      "formatCreateTime          object\n",
      "district                  object\n",
      "businessZones             object\n",
      "salary                     int64\n",
      "workYear                  object\n",
      "jobNature                 object\n",
      "education                 object\n",
      "positionAdvantage         object\n",
      "imState                   object\n",
      "lastLogin                 object\n",
      "publisherId                int64\n",
      "approve                    int64\n",
      "subwayline                object\n",
      "stationname               object\n",
      "linestaion                object\n",
      "latitude                 float64\n",
      "longitude                float64\n",
      "hitags                   float64\n",
      "resumeProcessRate          int64\n",
      "resumeProcessDay           int64\n",
      "score                      int64\n",
      "newScore                   int64\n",
      "matchScore               float64\n",
      "matchScoreExplain        float64\n",
      "query                    float64\n",
      "explain                  float64\n",
      "isSchoolJob                int64\n",
      "adWord                     int64\n",
      "plus                     float64\n",
      "pcShow                     int64\n",
      "appShow                    int64\n",
      "deliver                    int64\n",
      "gradeDescription         float64\n",
      "promotionScoreExplain    float64\n",
      "isHotHire                  int64\n",
      "count                      int64\n",
      "aggregatePositionIds      object\n",
      "famousCompany               bool\n",
      "dtype: object\n",
      "前几行数据:\n",
      "   positionId             positionName companyId companySize industryField  \\\n",
      "80    6310387                 业务与数据分析师     93448    150-500人     人工智能,数据服务   \n",
      "81    6602399          商业数据分析师（阿里数据银行）    100858     50-150人    移动互联网,广告营销   \n",
      "82    6820395  产品经理/数据分析（核心业务）-2020届春招    205347     2000人以上         金融,电商   \n",
      "83    6872841                  资深数据分析师       329     2000人以上            电商   \n",
      "84    6747553                  资深数据分析师    581460     2000人以上      电商,汽车丨出行   \n",
      "\n",
      "   financeStage                  companyLabelList  firstType secondType  \\\n",
      "80           B轮  ['技能培训', '股票期权', '带薪年假', '绩效奖金']  产品|需求|项目类       数据分析   \n",
      "81          天使轮  ['节日礼物', '带薪年假', '绩效奖金', '五险一金']     市场|商务类      市场|营销   \n",
      "82         上市公司   ['带薪年假', '定期体检', '免费班车', '领导好']  产品|需求|项目类       产品经理   \n",
      "83         上市公司  ['节日礼物', '技能培训', '免费班车', '带薪年假']  开发|测试|运维类       数据开发   \n",
      "84        D轮及以上   ['阿里合资', '六险一金', '独角兽', '行业先驱']     市场|商务类      市场|营销   \n",
      "\n",
      "   thirdType  ... plus pcShow appShow deliver gradeDescription  \\\n",
      "80      数据分析  ...  NaN      0       0       0              NaN   \n",
      "81    商业数据分析  ...  NaN      0       0       0              NaN   \n",
      "82      产品经理  ...  NaN      0       0       0              NaN   \n",
      "83      数据分析  ...  NaN      0       0       0              NaN   \n",
      "84    商业数据分析  ...  NaN      0       0       0              NaN   \n",
      "\n",
      "   promotionScoreExplain isHotHire  count aggregatePositionIds famousCompany  \n",
      "80                   NaN         0      0                   []         False  \n",
      "81                   NaN         0      0                   []         False  \n",
      "82                   NaN         0      0                   []          True  \n",
      "83                   NaN         0      0                   []          True  \n",
      "84                   NaN         0      0                   []         False  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "第10个数据块，形状: (10, 52)\n",
      "数据类型:\n",
      "positionId                object\n",
      "positionName              object\n",
      "companyId                 object\n",
      "companySize               object\n",
      "industryField             object\n",
      "financeStage              object\n",
      "companyLabelList          object\n",
      "firstType                 object\n",
      "secondType                object\n",
      "thirdType                 object\n",
      "skillLables               object\n",
      "positionLables            object\n",
      "industryLables            object\n",
      "createTime                object\n",
      "formatCreateTime          object\n",
      "district                  object\n",
      "businessZones             object\n",
      "salary                     int64\n",
      "workYear                  object\n",
      "jobNature                 object\n",
      "education                 object\n",
      "positionAdvantage         object\n",
      "imState                   object\n",
      "lastLogin                 object\n",
      "publisherId                int64\n",
      "approve                    int64\n",
      "subwayline                object\n",
      "stationname               object\n",
      "linestaion                object\n",
      "latitude                 float64\n",
      "longitude                float64\n",
      "hitags                   float64\n",
      "resumeProcessRate          int64\n",
      "resumeProcessDay           int64\n",
      "score                      int64\n",
      "newScore                   int64\n",
      "matchScore               float64\n",
      "matchScoreExplain        float64\n",
      "query                    float64\n",
      "explain                  float64\n",
      "isSchoolJob                int64\n",
      "adWord                     int64\n",
      "plus                     float64\n",
      "pcShow                     int64\n",
      "appShow                    int64\n",
      "deliver                    int64\n",
      "gradeDescription         float64\n",
      "promotionScoreExplain    float64\n",
      "isHotHire                  int64\n",
      "count                      int64\n",
      "aggregatePositionIds      object\n",
      "famousCompany               bool\n",
      "dtype: object\n",
      "前几行数据:\n",
      "   positionId   positionName companyId companySize industryField financeStage  \\\n",
      "90    6456921         数据分析专家    738016     50-150人       电商,数据服务          未融资   \n",
      "91    6888169  奔驰耀出行-战略数据分析师    751158    150-500人         移动互联网        不需要融资   \n",
      "92    6813626       资深数据分析专员    165939    150-500人          数据服务        不需要融资   \n",
      "93    6785139          数据分析师    665061     50-150人          企业服务           B轮   \n",
      "94    6818950        资深数据分析师    165939    150-500人          数据服务        不需要融资   \n",
      "\n",
      "                    companyLabelList  firstType secondType thirdType  ...  \\\n",
      "90                                []  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "91                                []  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "92  ['年底双薪', '带薪年假', '午餐补助', '定期体检']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "93                                []  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "94  ['年底双薪', '带薪年假', '午餐补助', '定期体检']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "\n",
      "   plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
      "90  NaN      0       0       0              NaN                   NaN   \n",
      "91  NaN      0       0       0              NaN                   NaN   \n",
      "92  NaN      0       0       0              NaN                   NaN   \n",
      "93  NaN      0       0       0              NaN                   NaN   \n",
      "94  NaN      0       0       0              NaN                   NaN   \n",
      "\n",
      "   isHotHire  count aggregatePositionIds famousCompany  \n",
      "90         0      0                   []         False  \n",
      "91         0      0                   []         False  \n",
      "92         0      0                   []         False  \n",
      "93         0      0                   []         False  \n",
      "94         0      0                   []         False  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "第11个数据块，形状: (5, 52)\n",
      "数据类型:\n",
      "positionId                object\n",
      "positionName              object\n",
      "companyId                 object\n",
      "companySize               object\n",
      "industryField             object\n",
      "financeStage              object\n",
      "companyLabelList          object\n",
      "firstType                 object\n",
      "secondType                object\n",
      "thirdType                 object\n",
      "skillLables               object\n",
      "positionLables            object\n",
      "industryLables            object\n",
      "createTime                object\n",
      "formatCreateTime          object\n",
      "district                  object\n",
      "businessZones             object\n",
      "salary                     int64\n",
      "workYear                  object\n",
      "jobNature                 object\n",
      "education                 object\n",
      "positionAdvantage         object\n",
      "imState                   object\n",
      "lastLogin                 object\n",
      "publisherId                int64\n",
      "approve                    int64\n",
      "subwayline                object\n",
      "stationname               object\n",
      "linestaion                object\n",
      "latitude                 float64\n",
      "longitude                float64\n",
      "hitags                    object\n",
      "resumeProcessRate          int64\n",
      "resumeProcessDay           int64\n",
      "score                      int64\n",
      "newScore                   int64\n",
      "matchScore               float64\n",
      "matchScoreExplain        float64\n",
      "query                    float64\n",
      "explain                  float64\n",
      "isSchoolJob                int64\n",
      "adWord                     int64\n",
      "plus                     float64\n",
      "pcShow                     int64\n",
      "appShow                    int64\n",
      "deliver                    int64\n",
      "gradeDescription         float64\n",
      "promotionScoreExplain    float64\n",
      "isHotHire                  int64\n",
      "count                      int64\n",
      "aggregatePositionIds      object\n",
      "famousCompany               bool\n",
      "dtype: object\n",
      "前几行数据:\n",
      "    positionId           positionName companyId companySize industryField  \\\n",
      "100    6884346                  数据分析师     21236   500-2000人   移动互联网,医疗丨健康   \n",
      "101    6849100                 商业数据分析     72076   500-2000人      移动互联网,电商   \n",
      "102    6803432        奔驰·耀出行-BI数据分析专家    751158    150-500人         移动互联网   \n",
      "103    6704835                BI数据分析师     52840     2000人以上            电商   \n",
      "104    6728058  数据分析专家-LQ(J181203029)      2474     2000人以上         汽车丨出行   \n",
      "\n",
      "    financeStage                  companyLabelList  firstType secondType  \\\n",
      "100           C轮  ['技能培训', '年底双薪', '节日礼物', '绩效奖金']  产品|需求|项目类       数据分析   \n",
      "101           C轮  ['节日礼物', '股票期权', '带薪年假', '年度旅游']     市场|商务类      市场|营销   \n",
      "102        不需要融资                                []  开发|测试|运维类       数据开发   \n",
      "103         上市公司  ['技能培训', '年底双薪', '节日礼物', '绩效奖金']  开发|测试|运维类       数据开发   \n",
      "104        不需要融资  ['弹性工作', '节日礼物', '岗位晋升', '技能培训']  产品|需求|项目类       数据分析   \n",
      "\n",
      "    thirdType  ... plus pcShow appShow deliver gradeDescription  \\\n",
      "100      数据分析  ...  NaN      0       0       0              NaN   \n",
      "101    商业数据分析  ...  NaN      0       0       0              NaN   \n",
      "102      数据分析  ...  NaN      0       0       0              NaN   \n",
      "103      数据分析  ...  NaN      0       0       0              NaN   \n",
      "104    其他数据分析  ...  NaN      0       0       0              NaN   \n",
      "\n",
      "    promotionScoreExplain isHotHire  count aggregatePositionIds famousCompany  \n",
      "100                   NaN         0      0                   []         False  \n",
      "101                   NaN         0      0                   []         False  \n",
      "102                   NaN         0      0                   []         False  \n",
      "103                   NaN         0      0                   []          True  \n",
      "104                   NaN         0      0                   []          True  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "\n",
      "=== 方法2：使用iterator=True参数 ===\n",
      "数据块形状: (10, 52)\n",
      "数据预览:\n",
      "  positionId positionName companyId companySize industryField financeStage  \\\n",
      "0    6802721         数据分析    475770     50-150人      移动互联网,电商           A轮   \n",
      "1    5204912         数据建模     50735    150-500人            电商           B轮   \n",
      "2    6877668         数据分析    100125     2000人以上    移动互联网,企业服务         上市公司   \n",
      "3    6496141         数据分析     26564   500-2000人            电商        D轮及以上   \n",
      "4    6467417         数据分析     29211     2000人以上         物流丨运输         上市公司   \n",
      "\n",
      "                    companyLabelList  firstType secondType thirdType  ...  \\\n",
      "0   ['绩效奖金', '带薪年假', '定期体检', '弹性工作']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "1   ['年终奖金', '做五休二', '六险一金', '子女福利']  开发|测试|运维类       数据开发        建模  ...   \n",
      "2   ['节日礼物', '年底双薪', '股票期权', '带薪年假']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "3  ['生日趴', '每月腐败基金', '每月补贴', '年度旅游']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "4   ['技能培训', '免费班车', '专项奖金', '岗位晋升']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "\n",
      "  plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
      "0  NaN      0       0       0              NaN                   NaN   \n",
      "1  NaN      0       0       0              NaN                   NaN   \n",
      "2  NaN      0       0       0              NaN                   NaN   \n",
      "3  NaN      0       0       0              NaN                   NaN   \n",
      "4  NaN      0       0       0              NaN                   NaN   \n",
      "\n",
      "  isHotHire  count aggregatePositionIds famousCompany  \n",
      "0         0      0                   []         False  \n",
      "1         0      0                   []         False  \n",
      "2         0      0                   []         False  \n",
      "3         0      0                   []          True  \n",
      "4         0      0                   []          True  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "数据块形状: (10, 52)\n",
      "数据预览:\n",
      "   positionId      positionName companyId companySize industryField  \\\n",
      "10    6804629             数据分析师     34132    150-500人     数据服务,广告营销   \n",
      "11    6847013  大数据分析工程师(J11108)     55046     2000人以上    移动互联网,企业服务   \n",
      "12    6763962           数据分析工程师     13163   500-2000人         移动互联网   \n",
      "13    6804489           资深数据分析师     34132    150-500人     数据服务,广告营销   \n",
      "14    6657285             数据分析师      7461     2000人以上          企业服务   \n",
      "\n",
      "   financeStage                     companyLabelList  firstType secondType  \\\n",
      "10           A轮  ['开放式办公', '扁平管理', '带薪假期', '弹性工作时间']  产品|需求|项目类       数据分析   \n",
      "11         上市公司     ['技能培训', '年底双薪', '带薪年假', '岗位晋升']  开发|测试|运维类       数据开发   \n",
      "12         上市公司     ['绩效奖金', '股票期权', '年底双薪', '专项奖金']  开发|测试|运维类       数据开发   \n",
      "13           A轮  ['开放式办公', '扁平管理', '带薪假期', '弹性工作时间']  开发|测试|运维类       数据开发   \n",
      "14         上市公司   ['工程师氛围', '弹性工作', '扁平管理', '上班不打卡']  产品|需求|项目类       数据分析   \n",
      "\n",
      "   thirdType  ... plus pcShow appShow deliver gradeDescription  \\\n",
      "10      数据分析  ...  NaN      0       0       0              NaN   \n",
      "11      数据分析  ...  NaN      0       0       0              NaN   \n",
      "12      数据分析  ...  NaN      0       0       0              NaN   \n",
      "13      数据分析  ...  NaN      0       0       0              NaN   \n",
      "14      数据分析  ...  NaN      0       0       0              NaN   \n",
      "\n",
      "   promotionScoreExplain isHotHire  count aggregatePositionIds famousCompany  \n",
      "10                   NaN         0      0                   []         False  \n",
      "11                   NaN         0      0                   []         False  \n",
      "12                   NaN         0      0                   []          True  \n",
      "13                   NaN         0      0                   []         False  \n",
      "14                   NaN         0      0                   []          True  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "数据块形状: (10, 52)\n",
      "数据预览:\n",
      "   positionId positionName companyId companySize industryField financeStage  \\\n",
      "20    6829277      资深数据分析师       593     2000人以上      移动互联网,游戏        不需要融资   \n",
      "21    6267370       数据分析专家     31544    150-500人          数据服务        不需要融资   \n",
      "22    5927901       数据分析经理        62     2000人以上         文娱丨内容           C轮   \n",
      "23    6862245       数据分析专家    473950     50-150人         移动互联网          未融资   \n",
      "24    5604926        数据分析师    143884     50-150人      移动互联网,金融           A轮   \n",
      "\n",
      "                        companyLabelList  firstType secondType thirdType  ...  \\\n",
      "20      ['五险一金', '交通补助', '绩效奖金', '节日礼物']  产品|需求|项目类     高端产品职位    数据分析专家  ...   \n",
      "21    ['专业红娘牵线', '节日礼物', '技能培训', '岗位晋升']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "22  ['扁平管理', '弹性工作', '大厨定制三餐', '就近租房补贴']  产品|需求|项目类       产品经理    其他产品经理  ...   \n",
      "23                                    []  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "24      ['股票期权', '带薪年假', '绩效奖金', '年底双薪']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "\n",
      "   plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
      "20  NaN      0       0       0              NaN                   NaN   \n",
      "21  NaN      0       0       0              NaN                   NaN   \n",
      "22  NaN      0       0       0              NaN                   NaN   \n",
      "23  NaN      0       0       0              NaN                   NaN   \n",
      "24  NaN      0       0       0              NaN                   NaN   \n",
      "\n",
      "   isHotHire  count aggregatePositionIds famousCompany  \n",
      "20         0      0                   []          True  \n",
      "21         0      0                   []         False  \n",
      "22         0      0                   []          True  \n",
      "23         0      0                   []         False  \n",
      "24         0      0                   []         False  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "数据块形状: (10, 52)\n",
      "数据预览:\n",
      "   positionId positionName companyId companySize industryField financeStage  \\\n",
      "30    6234992        数据分析师       542   500-2000人          消费生活        D轮及以上   \n",
      "31    6758467      店铺数据分析师     80863    150-500人      移动互联网,电商           B轮   \n",
      "32    6804489      资深数据分析师     34132    150-500人     数据服务,广告营销           A轮   \n",
      "33    6764017    数据分析师（社招）     13163   500-2000人         移动互联网         上市公司   \n",
      "34    6228290      商业数据分析师    509360     50-150人    移动互联网,企业服务           B轮   \n",
      "\n",
      "                       companyLabelList  firstType secondType thirdType  ...  \\\n",
      "30     ['六险一金', '快乐高效文化', '绩效奖金', '信任']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "31     ['技能培训', '带薪年假', '绩效奖金', '岗位晋升']     市场|商务类      市场|营销    商业数据分析  ...   \n",
      "32  ['开放式办公', '扁平管理', '带薪假期', '弹性工作时间']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "33     ['绩效奖金', '股票期权', '年底双薪', '专项奖金']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "34        ['定期体检', '帅哥多', '领导好', '美女多']     市场|商务类      市场|营销    商业数据分析  ...   \n",
      "\n",
      "   plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
      "30  NaN      0       0       0              NaN                   NaN   \n",
      "31  NaN      0       0       0              NaN                   NaN   \n",
      "32  NaN      0       0       0              NaN                   NaN   \n",
      "33  NaN      0       0       0              NaN                   NaN   \n",
      "34  NaN      0       0       0              NaN                   NaN   \n",
      "\n",
      "   isHotHire  count aggregatePositionIds famousCompany  \n",
      "30         0      0                   []          True  \n",
      "31         0      0                   []         False  \n",
      "32         0      0                   []         False  \n",
      "33         0      0                   []          True  \n",
      "34         0      0                   []         False  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "数据块形状: (10, 52)\n",
      "数据预览:\n",
      "   positionId positionName companyId companySize industryField financeStage  \\\n",
      "40    6791055      高级数据分析师    432882    150-500人         移动互联网        不需要融资   \n",
      "41    6869123  数据分析师（财务方向）    173746    150-500人          消费生活           C轮   \n",
      "42    6344146      资深数据分析师    522865    150-500人            游戏        不需要融资   \n",
      "43    5921220      财务数据分析师    137388    150-500人      移动互联网,电商        不需要融资   \n",
      "44    6653757      银行数据分析岗     23403     2000人以上          企业服务         上市公司   \n",
      "\n",
      "                      companyLabelList  firstType secondType thirdType  ...  \\\n",
      "40  ['技术大牛', '领导nice', '帅哥美女', '环境超棒']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "41                                  []  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "42    ['年底双薪', '专项奖金', '提供三餐', '便捷班车']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "43    ['年终分红', '绩效奖金', '定期体检', '年底双薪']  综合职能|高级管理         财务      财务风控  ...   \n",
      "44    ['五险一金', '通讯津贴', '带薪年假', '定期体检']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "\n",
      "   plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
      "40  NaN      0       0       0              NaN                   NaN   \n",
      "41  NaN      0       0       0              NaN                   NaN   \n",
      "42  NaN      0       0       0              NaN                   NaN   \n",
      "43  NaN      0       0       0              NaN                   NaN   \n",
      "44  NaN      0       0       0              NaN                   NaN   \n",
      "\n",
      "   isHotHire  count aggregatePositionIds famousCompany  \n",
      "40         0      0                   []         False  \n",
      "41         0      0                   []         False  \n",
      "42         0      0                   []         False  \n",
      "43         0      0                   []         False  \n",
      "44         0      0                   []         False  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "数据块形状: (10, 52)\n",
      "数据预览:\n",
      "   positionId      positionName companyId companySize industryField  \\\n",
      "50    6680900  数据分析师 (MJ000250)    114335    150-500人          数据服务   \n",
      "51    6191993   数据分析专家03-10-217     18655     2000人以上         汽车丨出行   \n",
      "52    6486069      解决方案顾问/数据分析师    166666    150-500人     企业服务,数据服务   \n",
      "53    6814233             数据分析师    619746     2000人以上            教育   \n",
      "54    6046775            数据分析专家    133429     50-150人    移动互联网,消费生活   \n",
      "\n",
      "   financeStage                  companyLabelList  firstType secondType  \\\n",
      "50           B轮   ['股票期权', '弹性工作', '领导好', '五险一金']  产品|需求|项目类       产品经理   \n",
      "51        D轮及以上    ['技能培训', 'Geek', '开放', '扁平管理']  开发|测试|运维类       数据开发   \n",
      "52           B轮  ['股票期权', '绩效奖金', '带薪年假', '弹性工作']  产品|需求|项目类       数据分析   \n",
      "53         上市公司  ['绩效奖金', '定期体检', '提供宿舍', '管理规范']  产品|需求|项目类       数据分析   \n",
      "54          未融资   ['年底双薪', '专项奖金', '美女多', '弹性工作']  产品|需求|项目类     高端产品职位   \n",
      "\n",
      "   thirdType  ... plus pcShow appShow deliver gradeDescription  \\\n",
      "50     数据分析师  ...  NaN      0       0       0              NaN   \n",
      "51      数据分析  ...  NaN      0       0       0              NaN   \n",
      "52      数据分析  ...  NaN      0       0       0              NaN   \n",
      "53      数据分析  ...  NaN      0       0       0              NaN   \n",
      "54    数据分析专家  ...  NaN      0       0       0              NaN   \n",
      "\n",
      "   promotionScoreExplain isHotHire  count aggregatePositionIds famousCompany  \n",
      "50                   NaN         0      0                   []         False  \n",
      "51                   NaN         0      0                   []          True  \n",
      "52                   NaN         0      0                   []         False  \n",
      "53                   NaN         0      0                   []         False  \n",
      "54                   NaN         0      0                   []         False  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "数据块形状: (10, 52)\n",
      "数据预览:\n",
      "   positionId       positionName companyId companySize industryField  \\\n",
      "60    5978750  数据分析师（保险）13-01-19     18655     2000人以上         汽车丨出行   \n",
      "61    5990647          高级财务数据分析师     18655     2000人以上         汽车丨出行   \n",
      "62    6191993    数据分析专家03-10-217     18655     2000人以上         汽车丨出行   \n",
      "63    6680900   数据分析师 (MJ000250)    114335    150-500人          数据服务   \n",
      "64    6789831            数据分析实习生    306282    150-500人    移动互联网,数据服务   \n",
      "\n",
      "   financeStage                  companyLabelList  firstType secondType  \\\n",
      "60        D轮及以上    ['技能培训', 'Geek', '开放', '扁平管理']  开发|测试|运维类       数据开发   \n",
      "61        D轮及以上    ['技能培训', 'Geek', '开放', '扁平管理']  综合职能|高级管理         财务   \n",
      "62        D轮及以上    ['技能培训', 'Geek', '开放', '扁平管理']  开发|测试|运维类       数据开发   \n",
      "63           B轮   ['股票期权', '弹性工作', '领导好', '五险一金']  产品|需求|项目类       产品经理   \n",
      "64          未融资  ['弹性工作', '技能培训', '岗位晋升', '五险一金']  开发|测试|运维类       数据开发   \n",
      "\n",
      "   thirdType  ... plus pcShow appShow deliver gradeDescription  \\\n",
      "60      数据分析  ...  NaN      0       0       0              NaN   \n",
      "61        财务  ...  NaN      0       0       0              NaN   \n",
      "62      数据分析  ...  NaN      0       0       0              NaN   \n",
      "63     数据分析师  ...  NaN      0       0       0              NaN   \n",
      "64      数据分析  ...  NaN      0       0       0              NaN   \n",
      "\n",
      "   promotionScoreExplain isHotHire  count aggregatePositionIds famousCompany  \n",
      "60                   NaN         0      0                   []          True  \n",
      "61                   NaN         0      0                   []          True  \n",
      "62                   NaN         0      0                   []          True  \n",
      "63                   NaN         0      0                   []         False  \n",
      "64                   NaN         0      0                   []         False  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "数据块形状: (10, 52)\n",
      "数据预览:\n",
      "   positionId  positionName companyId companySize industryField financeStage  \\\n",
      "70    6728610      高级数据分析专员     98316     2000人以上       电商,消费生活         上市公司   \n",
      "71    6793844       BI数据分析师    555182     50-150人      移动互联网,电商          天使轮   \n",
      "72    6794326       BI数据分析师    374014   500-2000人      移动互联网,金融           B轮   \n",
      "73    6819289         数据分析师     28103     2000人以上       消费生活,硬件         上市公司   \n",
      "74    6837340  数据分析-2020届春招    205347     2000人以上         金融,电商         上市公司   \n",
      "\n",
      "                      companyLabelList  firstType secondType thirdType  ...  \\\n",
      "70    ['午餐补助', '带薪年假', '定期体检', '年度旅游']     市场|商务类      市场|营销    商业数据分析  ...   \n",
      "71                                  []  运营|编辑|客服类         运营        运营  ...   \n",
      "72     ['弹性工作', '扁平管理', '领导好', '五险一金']  产品|需求|项目类       数据分析        BI  ...   \n",
      "73  ['定期体检', '五险一金', '专项奖金', '骨干家庭公寓']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "74     ['带薪年假', '定期体检', '免费班车', '领导好']  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "\n",
      "   plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
      "70  NaN      0       0       0              NaN                   NaN   \n",
      "71  NaN      0       0       0              NaN                   NaN   \n",
      "72  NaN      0       0       0              NaN                   NaN   \n",
      "73  NaN      0       0       0              NaN                   NaN   \n",
      "74  NaN      0       0       0              NaN                   NaN   \n",
      "\n",
      "   isHotHire  count aggregatePositionIds famousCompany  \n",
      "70         0      0                   []         False  \n",
      "71         0      0                   []         False  \n",
      "72         0      0                   []         False  \n",
      "73         0      0                   []          True  \n",
      "74         0      0                   []          True  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "数据块形状: (10, 52)\n",
      "数据预览:\n",
      "   positionId             positionName companyId companySize industryField  \\\n",
      "80    6310387                 业务与数据分析师     93448    150-500人     人工智能,数据服务   \n",
      "81    6602399          商业数据分析师（阿里数据银行）    100858     50-150人    移动互联网,广告营销   \n",
      "82    6820395  产品经理/数据分析（核心业务）-2020届春招    205347     2000人以上         金融,电商   \n",
      "83    6872841                  资深数据分析师       329     2000人以上            电商   \n",
      "84    6747553                  资深数据分析师    581460     2000人以上      电商,汽车丨出行   \n",
      "\n",
      "   financeStage                  companyLabelList  firstType secondType  \\\n",
      "80           B轮  ['技能培训', '股票期权', '带薪年假', '绩效奖金']  产品|需求|项目类       数据分析   \n",
      "81          天使轮  ['节日礼物', '带薪年假', '绩效奖金', '五险一金']     市场|商务类      市场|营销   \n",
      "82         上市公司   ['带薪年假', '定期体检', '免费班车', '领导好']  产品|需求|项目类       产品经理   \n",
      "83         上市公司  ['节日礼物', '技能培训', '免费班车', '带薪年假']  开发|测试|运维类       数据开发   \n",
      "84        D轮及以上   ['阿里合资', '六险一金', '独角兽', '行业先驱']     市场|商务类      市场|营销   \n",
      "\n",
      "   thirdType  ... plus pcShow appShow deliver gradeDescription  \\\n",
      "80      数据分析  ...  NaN      0       0       0              NaN   \n",
      "81    商业数据分析  ...  NaN      0       0       0              NaN   \n",
      "82      产品经理  ...  NaN      0       0       0              NaN   \n",
      "83      数据分析  ...  NaN      0       0       0              NaN   \n",
      "84    商业数据分析  ...  NaN      0       0       0              NaN   \n",
      "\n",
      "   promotionScoreExplain isHotHire  count aggregatePositionIds famousCompany  \n",
      "80                   NaN         0      0                   []         False  \n",
      "81                   NaN         0      0                   []         False  \n",
      "82                   NaN         0      0                   []          True  \n",
      "83                   NaN         0      0                   []          True  \n",
      "84                   NaN         0      0                   []         False  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "数据块形状: (10, 52)\n",
      "数据预览:\n",
      "   positionId   positionName companyId companySize industryField financeStage  \\\n",
      "90    6456921         数据分析专家    738016     50-150人       电商,数据服务          未融资   \n",
      "91    6888169  奔驰耀出行-战略数据分析师    751158    150-500人         移动互联网        不需要融资   \n",
      "92    6813626       资深数据分析专员    165939    150-500人          数据服务        不需要融资   \n",
      "93    6785139          数据分析师    665061     50-150人          企业服务           B轮   \n",
      "94    6818950        资深数据分析师    165939    150-500人          数据服务        不需要融资   \n",
      "\n",
      "                    companyLabelList  firstType secondType thirdType  ...  \\\n",
      "90                                []  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "91                                []  产品|需求|项目类       数据分析      数据分析  ...   \n",
      "92  ['年底双薪', '带薪年假', '午餐补助', '定期体检']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "93                                []  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "94  ['年底双薪', '带薪年假', '午餐补助', '定期体检']  开发|测试|运维类       数据开发      数据分析  ...   \n",
      "\n",
      "   plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
      "90  NaN      0       0       0              NaN                   NaN   \n",
      "91  NaN      0       0       0              NaN                   NaN   \n",
      "92  NaN      0       0       0              NaN                   NaN   \n",
      "93  NaN      0       0       0              NaN                   NaN   \n",
      "94  NaN      0       0       0              NaN                   NaN   \n",
      "\n",
      "   isHotHire  count aggregatePositionIds famousCompany  \n",
      "90         0      0                   []         False  \n",
      "91         0      0                   []         False  \n",
      "92         0      0                   []         False  \n",
      "93         0      0                   []         False  \n",
      "94         0      0                   []         False  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "数据块形状: (5, 52)\n",
      "数据预览:\n",
      "    positionId           positionName companyId companySize industryField  \\\n",
      "100    6884346                  数据分析师     21236   500-2000人   移动互联网,医疗丨健康   \n",
      "101    6849100                 商业数据分析     72076   500-2000人      移动互联网,电商   \n",
      "102    6803432        奔驰·耀出行-BI数据分析专家    751158    150-500人         移动互联网   \n",
      "103    6704835                BI数据分析师     52840     2000人以上            电商   \n",
      "104    6728058  数据分析专家-LQ(J181203029)      2474     2000人以上         汽车丨出行   \n",
      "\n",
      "    financeStage                  companyLabelList  firstType secondType  \\\n",
      "100           C轮  ['技能培训', '年底双薪', '节日礼物', '绩效奖金']  产品|需求|项目类       数据分析   \n",
      "101           C轮  ['节日礼物', '股票期权', '带薪年假', '年度旅游']     市场|商务类      市场|营销   \n",
      "102        不需要融资                                []  开发|测试|运维类       数据开发   \n",
      "103         上市公司  ['技能培训', '年底双薪', '节日礼物', '绩效奖金']  开发|测试|运维类       数据开发   \n",
      "104        不需要融资  ['弹性工作', '节日礼物', '岗位晋升', '技能培训']  产品|需求|项目类       数据分析   \n",
      "\n",
      "    thirdType  ... plus pcShow appShow deliver gradeDescription  \\\n",
      "100      数据分析  ...  NaN      0       0       0              NaN   \n",
      "101    商业数据分析  ...  NaN      0       0       0              NaN   \n",
      "102      数据分析  ...  NaN      0       0       0              NaN   \n",
      "103      数据分析  ...  NaN      0       0       0              NaN   \n",
      "104    其他数据分析  ...  NaN      0       0       0              NaN   \n",
      "\n",
      "    promotionScoreExplain isHotHire  count aggregatePositionIds famousCompany  \n",
      "100                   NaN         0      0                   []         False  \n",
      "101                   NaN         0      0                   []         False  \n",
      "102                   NaN         0      0                   []         False  \n",
      "103                   NaN         0      0                   []          True  \n",
      "104                   NaN         0      0                   []          True  \n",
      "\n",
      "[5 rows x 52 columns]\n",
      "--------------------------------------------------\n",
      "数据读取完成！\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "# 方法1：使用chunksize参数（推荐，更直接）\n",
    "def read_csv_chunked():\n",
    "    \"\"\"\n",
    "    读取CSV文件并返回可迭代对象，每次返回10行数据\n",
    "    使用chunksize参数，这是最常用的分块读取方法\n",
    "    \"\"\"\n",
    "    # 返回一个可迭代的TextFileReader对象\n",
    "    reader = pd.read_csv(\n",
    "        '某招聘网站数据.csv', \n",
    "        chunksize=10,  # 每次读取10行\n",
    "        dtype={'positionId': str, 'companyId': str}  # 设置指定列为字符串格式\n",
    "    )\n",
    "    return reader\n",
    "\n",
    "# 方法2：使用iterator=True参数（更灵活）\n",
    "def read_csv_iterator():\n",
    "    \"\"\"\n",
    "    使用iterator=True参数读取CSV文件\n",
    "    这种方式可以灵活调整每次读取的行数\n",
    "    \"\"\"\n",
    "    reader = pd.read_csv(\n",
    "        '某招聘网站数据.csv', \n",
    "        iterator=True,\n",
    "        dtype={'positionId': str, 'companyId': str}\n",
    "    )\n",
    "    return reader\n",
    "\n",
    "# 使用示例\n",
    "if __name__ == \"__main__\":\n",
    "    # 使用方法1：chunksize（推荐）\n",
    "    print(\"=== 方法1：使用chunksize参数 ===\")\n",
    "    chunk_reader = read_csv_chunked()\n",
    "    \n",
    "    # 遍历处理每个数据块\n",
    "    for i, chunk in enumerate(chunk_reader):\n",
    "        print(f\"第{i+1}个数据块，形状: {chunk.shape}\")\n",
    "        print(f\"数据类型:\\n{chunk.dtypes}\")\n",
    "        print(f\"前几行数据:\\n{chunk.head()}\")\n",
    "        print(\"-\" * 50)\n",
    "        \n",
    "        # 在这里添加你的数据处理逻辑\n",
    "        # 例如：数据清洗、分析、存储等\n",
    "        \n",
    "        # 如果只需要处理前几个块，可以添加break条件\n",
    "        # if i >= 2:  # 只处理前3个块\n",
    "        #     break\n",
    "    \n",
    "    # 使用方法2：iterator=True（需要时使用get_chunk方法）\n",
    "    print(\"\\n=== 方法2：使用iterator=True参数 ===\")\n",
    "    iterator_reader = read_csv_iterator()\n",
    "    \n",
    "    try:\n",
    "        while True:\n",
    "            # 每次获取10行数据\n",
    "            chunk = iterator_reader.get_chunk(10)\n",
    "            print(f\"数据块形状: {chunk.shape}\")\n",
    "            print(f\"数据预览:\\n{chunk.head()}\")\n",
    "            print(\"-\" * 50)\n",
    "            \n",
    "            # 添加你的处理逻辑\n",
    "            \n",
    "    except StopIteration:\n",
    "        print(\"数据读取完成！\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 17 读取 txt 文件｜常规\n",
    "\n",
    "<br>\n",
    "\n",
    "读取当前目录下 `Titanic.txt` 文件。\n",
    "\n",
    "注意：在接下来的几种格式文件读取中，对于之前重复的参数/功能将不再整理，仅介绍读取功能。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "# 文件由于太大，实际拿不到了，知道用法即可"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 18 读取 txt 文件｜含中文\n",
    "\n",
    "<br>\n",
    "\n",
    "读取当前目录下 `TOP250.txt` 文件。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "错误：文件 TOP250.txt 不存在\n",
      "\\n尝试使用其他参数读取...\n",
      "错误：文件 TOP250.txt 不存在\n",
      "错误：文件 TOP250.txt 不存在\n",
      "错误：文件 TOP250.txt 不存在\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import os\n",
    "\n",
    "def read_top250_txt(file_path='TOP250.txt', separator='\\t', \n",
    "                   header=None, encoding='utf-8', usecols=None):\n",
    "    \"\"\"\n",
    "    读取当前目录下的TOP250.txt文件\n",
    "    \n",
    "    参数:\n",
    "    file_path (str): 文件名，默认为'TOP250.txt'\n",
    "    separator (str): 文件分隔符，默认为制表符'\\\\t'\n",
    "    header: 指定列名行，None表示无列名，0表示第一行为列名\n",
    "    encoding (str): 文件编码，默认为'utf-8'\n",
    "    usecols (list): 指定要读取的列，如[0,1,2]\n",
    "    \"\"\"\n",
    "    # 检查文件是否存在\n",
    "    if not os.path.exists(file_path):\n",
    "        print(f\"错误：文件 {file_path} 不存在\")\n",
    "        return None\n",
    "    \n",
    "    try:\n",
    "        # 使用pandas读取txt文件[1,4](@ref)\n",
    "        # read_csv可以读取txt文件，通过sep参数指定分隔符[4,6](@ref)\n",
    "        df = pd.read_csv(\n",
    "            file_path,\n",
    "            sep=separator,\n",
    "            header=header,\n",
    "            encoding=encoding,\n",
    "            usecols=usecols\n",
    "        )\n",
    "        \n",
    "        print(f\"成功读取文件: {file_path}\")\n",
    "        print(f\"数据形状: {df.shape}\")\n",
    "        print(\"\\\\n前5行数据预览:\")\n",
    "        print(df.head())\n",
    "        \n",
    "        return df\n",
    "        \n",
    "    except FileNotFoundError:\n",
    "        print(f\"文件 {file_path} 不存在\")\n",
    "    except pd.errors.EmptyDataError:\n",
    "        print(\"文件为空\")\n",
    "    except pd.errors.ParserError as e:\n",
    "        print(f\"解析错误: {e}\")\n",
    "        print(\"请检查分隔符设置是否正确\")\n",
    "    except UnicodeDecodeError:\n",
    "        print(\"编码错误，尝试使用 'gbk' 或 'latin-1' 编码\")\n",
    "    except Exception as e:\n",
    "        print(f\"读取文件时发生错误: {e}\")\n",
    "    \n",
    "    return None\n",
    "\n",
    "# 主程序\n",
    "if __name__ == \"__main__\":\n",
    "    # 基本读取（使用默认参数）\n",
    "    df = read_top250_txt()\n",
    "    \n",
    "    # 如果基本读取失败，可以尝试其他方式\n",
    "    if df is None:\n",
    "        print(\"\\\\n尝试使用其他参数读取...\")\n",
    "        \n",
    "        # 尝试使用空格分隔符[4](@ref)\n",
    "        df = read_top250_txt(separator=' ')\n",
    "        \n",
    "        # 如果仍然失败，尝试使用逗号分隔符\n",
    "        if df is None:\n",
    "            df = read_top250_txt(separator=',')\n",
    "            \n",
    "        # 尝试不同编码\n",
    "        if df is None:\n",
    "            df = read_top250_txt(encoding='gbk')\n",
    "    \n",
    "    # 如果成功读取数据，可以进行进一步处理\n",
    "    if df is not None:\n",
    "        print(\"\\n\" + \"=\"*50)\n",
    "        print(\"数据基本信息:\")\n",
    "        print(\"=\"*50)\n",
    "        \n",
    "        # 显示数据基本信息[6](@ref)\n",
    "        print(df.info())\n",
    "        \n",
    "        print(\"\\n数据描述性统计:\")\n",
    "        print(df.describe())\n",
    "        \n",
    "        # 保存处理后的数据（可选）\n",
    "        # df.to_csv('processed_TOP250.csv', index=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 19 读取 JSON 文件\n",
    "\n",
    "\n",
    "\n",
    "<br>\n",
    "\n",
    "读取当前目录下 `某基金数据.json` 文件。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "         净值日期   单位净值   累计净值    日增长率  申购状态  赎回状态  分红送配\n",
      "0  2020-02-13  1.884  1.884  -0.11%  开放申购  开放赎回   NaN\n",
      "1  2020-02-12  1.886  1.886   3.34%  开放申购  开放赎回   NaN\n",
      "2  2020-02-11  1.825  1.825  -0.16%  开放申购  开放赎回   NaN\n",
      "3  2020-02-10  1.828  1.828   1.33%  开放申购  开放赎回   NaN\n",
      "4  2020-02-07  1.804  1.804   0.61%  开放申购  开放赎回   NaN\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "df=pd.read_json('某基金数据.json')\n",
    "print(df.head())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 20 读取 HDF5 文件\n",
    "\n",
    "<br>\n",
    "\n",
    "`HDF5`是一种特殊的文件格式，常见于在大规模存储数据上\n",
    "\n",
    "关于 `pandas` 与 `hdf5` 格式文件的操作较多，下面仅学习如何读取。\n",
    "\n",
    "读取当前目录下`store_tl.h5`文件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['/', '/table']\n",
      "   A  B\n",
      "0  0  0\n",
      "1  1  1\n",
      "2  2  2\n",
      "3  3  3\n",
      "4  4  4\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "with pd.HDFStore('store_tl.h5') as store:\n",
    "    print(store.keys()) # 打印出文件中所有可用的key\n",
    "\n",
    "df=pd.read_hdf('store_tl.h5',key='table')\n",
    "print(df.head())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "微信搜索公众号「早起Python」，关注后可以获得更多资源！"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#  不需做任何事"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 21 从剪贴板读取数据\n",
    "\n",
    "<br>\n",
    "\n",
    "打开当前目录下 `Titanic.txt` 文件，全选并复制。\n",
    "\n",
    "现在直接从剪贴板读取数据。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "ename": "ParserError",
     "evalue": "Expected 19 fields in line 7, saw 20. Error could possibly be due to quotes being ignored when a multi-char delimiter is used.",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mParserError\u001b[0m                               Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[6], line 2\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mpandas\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mpd\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m df \u001b[38;5;241m=\u001b[39m \u001b[43mpd\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread_clipboard\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m      3\u001b[0m \u001b[38;5;28mprint\u001b[39m(df\u001b[38;5;241m.\u001b[39mhead())\n",
      "File \u001b[1;32md:\\Soft\\Python\\Python310\\lib\\site-packages\\pandas\\io\\clipboards.py:129\u001b[0m, in \u001b[0;36mread_clipboard\u001b[1;34m(sep, dtype_backend, **kwargs)\u001b[0m\n\u001b[0;32m    123\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(sep) \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m1\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m kwargs\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mengine\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mc\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[0;32m    124\u001b[0m     warnings\u001b[38;5;241m.\u001b[39mwarn(\n\u001b[0;32m    125\u001b[0m         \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mread_clipboard with regex separator does not work properly with c engine.\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m    126\u001b[0m         stacklevel\u001b[38;5;241m=\u001b[39mfind_stack_level(),\n\u001b[0;32m    127\u001b[0m     )\n\u001b[1;32m--> 129\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m read_csv(StringIO(text), sep\u001b[38;5;241m=\u001b[39msep, dtype_backend\u001b[38;5;241m=\u001b[39mdtype_backend, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n",
      "File \u001b[1;32md:\\Soft\\Python\\Python310\\lib\\site-packages\\pandas\\io\\parsers\\readers.py:1026\u001b[0m, in \u001b[0;36mread_csv\u001b[1;34m(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, date_format, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, encoding_errors, dialect, on_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options, dtype_backend)\u001b[0m\n\u001b[0;32m   1013\u001b[0m kwds_defaults \u001b[38;5;241m=\u001b[39m _refine_defaults_read(\n\u001b[0;32m   1014\u001b[0m     dialect,\n\u001b[0;32m   1015\u001b[0m     delimiter,\n\u001b[1;32m   (...)\u001b[0m\n\u001b[0;32m   1022\u001b[0m     dtype_backend\u001b[38;5;241m=\u001b[39mdtype_backend,\n\u001b[0;32m   1023\u001b[0m )\n\u001b[0;32m   1024\u001b[0m kwds\u001b[38;5;241m.\u001b[39mupdate(kwds_defaults)\n\u001b[1;32m-> 1026\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_read\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfilepath_or_buffer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mkwds\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[1;32md:\\Soft\\Python\\Python310\\lib\\site-packages\\pandas\\io\\parsers\\readers.py:626\u001b[0m, in \u001b[0;36m_read\u001b[1;34m(filepath_or_buffer, kwds)\u001b[0m\n\u001b[0;32m    623\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m parser\n\u001b[0;32m    625\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m parser:\n\u001b[1;32m--> 626\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mparser\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnrows\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[1;32md:\\Soft\\Python\\Python310\\lib\\site-packages\\pandas\\io\\parsers\\readers.py:1923\u001b[0m, in \u001b[0;36mTextFileReader.read\u001b[1;34m(self, nrows)\u001b[0m\n\u001b[0;32m   1916\u001b[0m nrows \u001b[38;5;241m=\u001b[39m validate_integer(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnrows\u001b[39m\u001b[38;5;124m\"\u001b[39m, nrows)\n\u001b[0;32m   1917\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m   1918\u001b[0m     \u001b[38;5;66;03m# error: \"ParserBase\" has no attribute \"read\"\u001b[39;00m\n\u001b[0;32m   1919\u001b[0m     (\n\u001b[0;32m   1920\u001b[0m         index,\n\u001b[0;32m   1921\u001b[0m         columns,\n\u001b[0;32m   1922\u001b[0m         col_dict,\n\u001b[1;32m-> 1923\u001b[0m     ) \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_engine\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[43m  \u001b[49m\u001b[38;5;66;43;03m# type: ignore[attr-defined]\u001b[39;49;00m\n\u001b[0;32m   1924\u001b[0m \u001b[43m        \u001b[49m\u001b[43mnrows\u001b[49m\n\u001b[0;32m   1925\u001b[0m \u001b[43m    \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m   1926\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m:\n\u001b[0;32m   1927\u001b[0m     \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mclose()\n",
      "File \u001b[1;32md:\\Soft\\Python\\Python310\\lib\\site-packages\\pandas\\io\\parsers\\python_parser.py:288\u001b[0m, in \u001b[0;36mPythonParser.read\u001b[1;34m(self, rows)\u001b[0m\n\u001b[0;32m    285\u001b[0m     indexnamerow \u001b[38;5;241m=\u001b[39m content[\u001b[38;5;241m0\u001b[39m]\n\u001b[0;32m    286\u001b[0m     content \u001b[38;5;241m=\u001b[39m content[\u001b[38;5;241m1\u001b[39m:]\n\u001b[1;32m--> 288\u001b[0m alldata \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_rows_to_cols\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcontent\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    289\u001b[0m data, columns \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_exclude_implicit_index(alldata)\n\u001b[0;32m    291\u001b[0m conv_data \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_convert_data(data)\n",
      "File \u001b[1;32md:\\Soft\\Python\\Python310\\lib\\site-packages\\pandas\\io\\parsers\\python_parser.py:1063\u001b[0m, in \u001b[0;36mPythonParser._rows_to_cols\u001b[1;34m(self, content)\u001b[0m\n\u001b[0;32m   1057\u001b[0m             reason \u001b[38;5;241m=\u001b[39m (\n\u001b[0;32m   1058\u001b[0m                 \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mError could possibly be due to quotes being \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m   1059\u001b[0m                 \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mignored when a multi-char delimiter is used.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m   1060\u001b[0m             )\n\u001b[0;32m   1061\u001b[0m             msg \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m. \u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m+\u001b[39m reason\n\u001b[1;32m-> 1063\u001b[0m         \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_alert_malformed\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmsg\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrow_num\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[0;32m   1065\u001b[0m \u001b[38;5;66;03m# see gh-13320\u001b[39;00m\n\u001b[0;32m   1066\u001b[0m zipped_content \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlist\u001b[39m(lib\u001b[38;5;241m.\u001b[39mto_object_array(content, min_width\u001b[38;5;241m=\u001b[39mcol_len)\u001b[38;5;241m.\u001b[39mT)\n",
      "File \u001b[1;32md:\\Soft\\Python\\Python310\\lib\\site-packages\\pandas\\io\\parsers\\python_parser.py:781\u001b[0m, in \u001b[0;36mPythonParser._alert_malformed\u001b[1;34m(self, msg, row_num)\u001b[0m\n\u001b[0;32m    764\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m    765\u001b[0m \u001b[38;5;124;03mAlert a user about a malformed row, depending on value of\u001b[39;00m\n\u001b[0;32m    766\u001b[0m \u001b[38;5;124;03m`self.on_bad_lines` enum.\u001b[39;00m\n\u001b[1;32m   (...)\u001b[0m\n\u001b[0;32m    778\u001b[0m \u001b[38;5;124;03m    even though we 0-index internally.\u001b[39;00m\n\u001b[0;32m    779\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m    780\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mon_bad_lines \u001b[38;5;241m==\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mBadLineHandleMethod\u001b[38;5;241m.\u001b[39mERROR:\n\u001b[1;32m--> 781\u001b[0m     \u001b[38;5;28;01mraise\u001b[39;00m ParserError(msg)\n\u001b[0;32m    782\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mon_bad_lines \u001b[38;5;241m==\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mBadLineHandleMethod\u001b[38;5;241m.\u001b[39mWARN:\n\u001b[0;32m    783\u001b[0m     warnings\u001b[38;5;241m.\u001b[39mwarn(\n\u001b[0;32m    784\u001b[0m         \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSkipping line \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mrow_num\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmsg\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m    785\u001b[0m         ParserWarning,\n\u001b[0;32m    786\u001b[0m         stacklevel\u001b[38;5;241m=\u001b[39mfind_stack_level(),\n\u001b[0;32m    787\u001b[0m     )\n",
      "\u001b[1;31mParserError\u001b[0m: Expected 19 fields in line 7, saw 20. Error could possibly be due to quotes being ignored when a multi-char delimiter is used."
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "df = pd.read_clipboard()\n",
    "print(df.head())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 22 从 SQL 读取数据\n",
    "\n",
    "<br>\n",
    "\n",
    "有时我们需要从 `SQL` 中读取数据，如果先将数据导出再`pandas`读取并不是一个合适的选择。\n",
    "\n",
    "在 `pandas` 中支持直接从 `sql` 中查询并读取。\n",
    "\n",
    "为了方便统一操作，请先执行下面的代码创建数据。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sqlite3 import connect\n",
    "conn = connect(':memory:')\n",
    "df = pd.DataFrame(data=[[0, '10/11/12'], [1, '12/11/10']],\n",
    "                  columns=['int_column', 'date_column'])\n",
    "df.to_sql('test_data', conn)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "下面将 `SQL` 语句 `SELECT int_column, date_column FROM test_data` 转换为 `DataFrame`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "从数据库读取的DataFrame:\n",
      "   int_column date_column\n",
      "0           0    10/11/12\n",
      "1           1    12/11/10\n",
      "\n",
      "DataFrame数据类型:\n",
      "int_column      int64\n",
      "date_column    object\n",
      "dtype: object\n"
     ]
    }
   ],
   "source": [
    "import sqlite3\n",
    "import pandas as pd\n",
    "\n",
    "# 使用上下文管理器连接到内存中的数据库（推荐，可自动关闭连接）\n",
    "with sqlite3.connect(':memory:') as conn:\n",
    "    # 重建您之前的创建表和插入数据的步骤\n",
    "    df_to_store = pd.DataFrame(data=[[0, '10/11/12'], [1, '12/11/10']],\n",
    "                              columns=['int_column', 'date_column'])\n",
    "    df_to_store.to_sql('test_data', conn, index=False, if_exists='replace') # 使用if_exists='replace'确保表存在时被替换\n",
    "    \n",
    "    # ⭐ 核心步骤：使用read_sql_query读取数据\n",
    "    # 编写您的SQL查询\n",
    "    sql_query = \"SELECT int_column, date_column FROM test_data\"\n",
    "    # 执行查询并直接转换为DataFrame\n",
    "    df = pd.read_sql_query(sql_query, conn)\n",
    "\n",
    "# 查看结果\n",
    "print(\"从数据库读取的DataFrame:\")\n",
    "print(df)\n",
    "print(f\"\\nDataFrame数据类型:\\n{df.dtypes}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   id  name  age\n",
      "0   6  atkm   19\n",
      "1   7  v0vm   23\n",
      "2   8  8o76   19\n",
      "3   9  od4a   27\n",
      "4  10  7cp2   11\n"
     ]
    }
   ],
   "source": [
    "# 测试mysql本地查询\n",
    "import pandas as pd\n",
    "from sqlalchemy import create_engine\n",
    "\n",
    "# 创建数据库引擎。连接字符串格式为：`mysql+驱动://用户名:密码@主机:端口/数据库名`\n",
    "engine = create_engine('mysql+pymysql://root:123456@localhost:3306/test')\n",
    "\n",
    "# 编写你的SQL查询语句\n",
    "sql_query = \"SELECT * FROM student\"\n",
    "\n",
    "# 使用 read_sql_query 执行查询并获取 DataFrame\n",
    "df = pd.read_sql_query(sql_query, engine)\n",
    "\n",
    "# 显示DataFrame的前几行\n",
    "print(df.head())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 23 从网页读取数据\n",
    "\n",
    "<br>\n",
    "\n",
    "直接从东京奥运会官网读取奖牌榜数据。\n",
    "\n",
    "目标网站地址为 `https://olympics.com/tokyo-2020/olympic-games/zh/results/all-sports/medal-standings.htm`\n",
    "\n",
    "思考：什么类型的在线表格可以直接读取？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "ename": "",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m无法执行代码，已释放会话。请尝试重新启动内核。"
     ]
    },
    {
     "ename": "",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m无法执行代码，已释放会话。请尝试重新启动内核。. \n",
      "\u001b[1;31m有关更多详细信息，请查看 Jupyter <a href='command:jupyter.viewOutput'>log</a>。"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "# 从URL读取表格\n",
    "url = 'https://olympics.com/tokyo-2020/olympic-games/zh/results/all-sports/medal-standings.htm'\n",
    "tables = pd.read_html(url) \n",
    "df = tables[0] # 通常选择列表中的第一个DataFrame\n",
    "print(df)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 24 循环读取数据\n",
    "\n",
    "<br>\n",
    "\n",
    "在本小节 `demodata` 文件夹下有多个 `Excel` 文件，要求一次性循环读取全部文件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "成功合并了 10 个Excel文件。\n",
      "合并后数据总维度：3410 行 × 7 列\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import os\n",
    "\n",
    "# 1. 指定文件夹路径\n",
    "folder_path = 'demodata'  # 请替换为你的实际路径\n",
    "\n",
    "# 2. 创建一个空列表来存储每个Excel文件的数据\n",
    "data_frames = []\n",
    "\n",
    "# 3. 遍历文件夹中的每个文件\n",
    "for file_name in os.listdir(folder_path):\n",
    "    # 检查文件是否为Excel文件（支持.xlsx和.xls格式）\n",
    "    if file_name.endswith('.xlsx') or file_name.endswith('.xls'):\n",
    "        # 跳过Excel的临时缓存文件（通常以~$开头）\n",
    "        if file_name.startswith('~$'):\n",
    "            continue\n",
    "        # 构建文件的完整路径\n",
    "        file_path = os.path.join(folder_path, file_name)\n",
    "        # 使用pandas读取Excel文件\n",
    "        df = pd.read_excel(file_path)  # 可根据需要添加sheet_name, skiprows等参数\n",
    "        # 将读取到的DataFrame添加到列表中\n",
    "        data_frames.append(df)\n",
    "\n",
    "# 4. 合并所有DataFrame\n",
    "if data_frames:  # 确保列表不为空\n",
    "    combined_data = pd.concat(data_frames, ignore_index=True)\n",
    "    # ignore_index=True 会重置合并后数据的行索引，避免重复\n",
    "    \n",
    "    # 5. (可选) 保存合并后的数据到新Excel文件\n",
    "    # combined_data.to_excel('合并后的文件.xlsx', index=False)\n",
    "    \n",
    "    print(f\"成功合并了 {len(data_frames)} 个Excel文件。\")\n",
    "    print(f\"合并后数据总维度：{combined_data.shape[0]} 行 × {combined_data.shape[1]} 列\")\n",
    "else:\n",
    "    print(\"指定文件夹内未找到符合条件的Excel文件。\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1-2 数据创建\n",
    "\n",
    "<br>\n",
    "\n",
    "除了直接读取本地文件，学会直接创建数据框也很重要，常见于测试一些函数，下面是从常见数据结构创建数据框的方法整理"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "下面这个表格汇总了直接创建DataFrame的几种主要数据输入方式及其特点。\n",
    "\n",
    "| 数据输入方式 | 描述与关键点 | 示例代码（简要） |\n",
    "| :--- | :--- | :--- |\n",
    "| **Python字典** | 键(key)作为列名，值(value)作为列数据。值可以是**列表、元组或NumPy数组**，但**长度必须一致**。 | `df = pd.DataFrame({'A': [1,2], 'B': [3,4]})` |\n",
    "| **字典列表** | 列表中的每个字典代表**一行数据**。字典的键会自动合并形成列名，**缺失值用NaN填充**。 | `df = pd.DataFrame([{'A':1, 'B':2}, {'A':5, 'B':10, 'C':20}])` |\n",
    "| **嵌套列表/二维数组** | 外层列表的每个元素代表一行数据。通常需要**同时指定`columns`参数**来设置列名。 | `df = pd.DataFrame([[1,2], [3,4]], columns=['Col1', 'Col2'])` |\n",
    "| **Series对象的字典** | 每个Series是一列数据。**Series可以拥有不同的索引**，创建DataFrame时会按行索引对齐，不匹配处填充NaN。 | `data = {\"x\": pd.Series([1,2], index=['a','b']), \"y\": pd.Series([5,6,7], index=['a','b','c'])}`<br>`df = pd.DataFrame(data)` |\n",
    "| **NumPy二维数组** | 直接将NumPy的ndarray转换为DataFrame。可以**通过`columns`和`index`参数指定行列标签**。 | `df = pd.DataFrame(np.array([[1,2,3], [4,5,6]]), columns=['a','b','c'])` |\n",
    "\n",
    "除了核心的`data`参数，`pd.DataFrame()`还提供了一些重要参数来控制数据框的结构和属性，如下表所示。\n",
    "\n",
    "| 参数名 | 功能描述 | 注意事项与示例 |\n",
    "| :--- | :--- | :--- |\n",
    "| `index` | 设置**行索引标签**。 | 传入一个与数据行数相同的列表或数组。如果不指定，默认为从0开始的整数序列（RangeIndex）。 |\n",
    "| `columns` | 设置**列索引标签（表头）**。 | 传入一个与数据列数相同的列表或数组。此参数在从嵌套列表或二维数组创建时尤为重要。 |\n",
    "| `dtype` | 强制设置**整个DataFrame的数据类型**。 | 通常Pandas会自动推断数据类型。使用此参数可统一类型（如`dtype=float`）。注意，如果数据与指定类型不兼容可能会报错。 |\n",
    "| `copy` | 决定是否**从输入数据中复制数据**。 | 默认为`False`。如果输入数据已是ndarray或DataFrame且你希望后续操作不影响原数据，可设置为`True`进行深拷贝。 |\n",
    "\n",
    "### 💡 使用技巧与选择建议\n",
    "\n",
    "-   **数据源选择**：处理规整的、列导向的数据（如从数据库查询的结果）时，**字典形式非常直观**。如果数据本身是行导向的（如从JSON文件读取的记录），**字典列表会更方便**。而从CSV文件读取数据时，其内在结构类似于嵌套列表。\n",
    "-   **行列标签**：为DataFrame设置具有明确意义的`index`和`columns`，可以极大提升数据的可读性，并方便后续使用`loc`、`iloc`等进行高效的数据检索。\n",
    "-   **性能考虑**：对于非常大的数据集，需要注意`copy`参数的使用。在确保数据安全的前提下，避免不必要的数据复制可以节省内存。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 25 从列表创建\n",
    "\n",
    "<br>\n",
    "\n",
    "将下面的 `list` 转换为 `dataframe`，并指定列名为`\"早起Python\"`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "l = [1,2,3,4,5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "l=range(1,6)\n",
    "df=pd.DataFrame({\n",
    "    '早起Python':l\n",
    "})"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 26 从列表创建｜嵌套列表\n",
    "\n",
    "<br>\n",
    "\n",
    "将下面的 `list` 转换为 `dataframe`，并指定行索引为`\"公众号\",\"早起Python\"`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "l = [[1,2,3],[4,5,6]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "l = [[1,2,3],[4,5,6]]\n",
    "df=pd.DataFrame({\n",
    "    '公众号':l[0],\n",
    "    '早起Python':l[1]\n",
    "})"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![公众号：早起Python](http://liuzaoqi.oss-cn-beijing.aliyuncs.com/2021/09/18/16319660121648.jpg?域名/sample.jpg?x-oss-process=style/stylename)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 27 从字典创建"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "执行下方代码，并将字典转换为`dataframe`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "d = {\n",
    "    \"one\": pd.Series([1.0, 2.0, 3.0], index=[\"a\", \"b\", \"c\"]),\n",
    "    \"two\": pd.Series([1.0, 2.0, 3.0, 4.0], index=[\"a\", \"b\", \"c\", \"d\"]) }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "d = {\n",
    "    \"one\": pd.Series([1.0, 2.0, 3.0], index=[\"a\", \"b\", \"c\"]),\n",
    "    \"two\": pd.Series([1.0, 2.0, 3.0, 4.0], index=[\"a\", \"b\", \"c\", \"d\"]) }\n",
    "df=pd.DataFrame(d)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 28 从字典创建｜指定索引\n",
    "\n",
    "<br>\n",
    "\n",
    "还是上一题的字典`d`，将其转换为`dataframe`并指定索引顺序为 `d、b、a`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "d = {\n",
    "    \"one\": pd.Series([1.0, 2.0, 3.0], index=[\"a\", \"b\", \"c\"]),\n",
    "    \"two\": pd.Series([1.0, 2.0, 3.0, 4.0], index=[\"a\", \"b\", \"c\", \"d\"]) }\n",
    "df=pd.DataFrame(d)\n",
    "re_df=df.reindex(index=['d','b','a'])\n",
    "sort_df=df.sort_index(ascending=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "下面是一个对比表格，帮助你快速了解这些方法及其适用场景：\n",
    "\n",
    "| 方法 | 主要用途 | 关键参数/用法 | 是否改变原数据 |\n",
    "| :--- | :--- | :--- | :--- |\n",
    "| **`df.reindex()`** | **按自定义顺序重新排列索引**，可处理新索引（填充NaN） | `index=`, `columns=`, `axis=`, `fill_value=` | 默认返回新对象，需`inplace=True`或赋值 |\n",
    "| **`df.sort_index()`** | 按索引的**字母或数值顺序**进行排序（升序/降序） | `ascending=`, `axis=`, `level=`（多层索引） | 默认返回新对象，`inplace=True`可修改原数据 |\n",
    "| **`df.set_index()`** | 将某一（些）列设置为新索引 | `keys=`, `drop=True`（是否删除原列） | 默认返回新对象，`inplace=True`可修改原数据 |\n",
    "| **直接赋值** | 直接替换整个行/列索引标签 | `df.index = new_index`, `df.columns = new_columns` | 直接修改原数据 |"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 29 从字典创建｜指定列名\n",
    "\n",
    "<br>\n",
    "\n",
    "还是上一题的字典`d`，将其转换为`dataframe`并指定索引顺序为 `d、b、a`，列名为`\"two\", \"three\"`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "d = {\n",
    "    \"one\": pd.Series([1.0, 2.0, 3.0], index=[\"a\", \"b\", \"c\"]),\n",
    "    \"two\": pd.Series([1.0, 2.0, 3.0, 4.0], index=[\"a\", \"b\", \"c\", \"d\"]) }\n",
    "df=pd.DataFrame(d)\n",
    "re_df=df.reindex(index=['d','b','a'])\n",
    "# 重命名列\n",
    "df1=re_df.rename(columns={\n",
    "    'two':'one',\n",
    "    'three':'two'\n",
    "})\n",
    "# 必须提供与列数相等的新名称列表\n",
    "re_df.columns = ['two', 'three']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "下面这个表格汇总了最常用的几种方法及其核心特点，方便你快速选择和查阅。\n",
    "\n",
    "| 方法 | 适用场景 | 关键特性/参数 | 是否就地修改 |\n",
    "| :--- | :--- | :--- | :--- |\n",
    "| **`df.rename()`** | **重命名部分列**，灵活性高 | `columns={旧名: 新名}`, `inplace=True` | 可控制（默认`False`） |\n",
    "| **直接赋值** | **一次性重命名所有列** | `df.columns = [新列名列表]` | 总是就地修改 |\n",
    "| **`df.set_axis()`** | 按指定轴设置标签，可用于行或列 | `labels=新标签列表`, `axis=1`（列）, `inplace=True` | 可控制（默认`False`） |\n",
    "| **`df.columns.map()`** | **批量模式化修改**列名（如统一添加前缀） | 结合`lambda`函数或自定义函数 | 总是就地修改（因是赋值） |"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 30 从字典创建｜字典列表\n",
    "<br>\n",
    "\n",
    "将下方列表型字典转换为`dataframe`\n",
    "\n",
    "思考：如何指定行/列索引？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "d = [{\"a\": 1, \"b\": 2}, {\"a\": 5, \"b\": 10, \"c\": 20}]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 直接作为初始参数即可\n",
    "df=pd.DataFrame(d)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 31 从集合创建\n",
    "\n",
    "<br>\n",
    "\n",
    "将下面的元组转换为 dataframe 且行列索引均为 `1,2,3,4`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "t =((1,0,0,0,),(2,3,0,0,),(4,5,6,0,),(7,8,9,10,))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "df=pd.DataFrame(t,index=[1,2,3,4],columns=[1,2,3,4])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1-3 数据存储"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 32 保存为 CSV\n",
    "\n",
    "<br>\n",
    "\n",
    "将第三题读取到的数据保存为 `csv` 格式至当前目录下（文件名任意）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pd.read_csv(\"某招聘网站数据.csv\",nrows = 20)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 需要先创建output文件夹\n",
    "data.to_csv('output/data32.csv')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "to_csv() 方法常用参数详解\n",
    "\n",
    "| 参数 | 说明 | 默认值 |\n",
    "| :--- | :--- | :--- |\n",
    "| **`path_or_buf`** | 文件保存路径或文件对象。如为`None`，则返回CSV格式的字符串。 | `None` |\n",
    "| **`sep`** | 指定字段之间的分隔符。 | 逗号 `,` |\n",
    "| **`na_rep`** | 指定用于表示缺失值（如NaN）的字符串。 | 空字符串 |\n",
    "| **`float_format`** | 用于格式化浮点数输出的格式字符串，例如控制小数点位数。 | `None` |\n",
    "| **`columns`** | 指定要写入文件的列，以列名列表的形式传入。 | `None` (所有列) |\n",
    "| **`header`** | 控制是否将列名写入文件。可为布尔值或字符串列表（用于替换列名）。 | `True` |\n",
    "| **`index`** | 控制是否将行索引写入文件。 | `True` |\n",
    "| **`index_label`** | 为索引列指定一个列标签。如果为`False`且`header`为`True`，则不输出索引名称。 | `None` |\n",
    "| **`mode`** | 文件写入模式：`'w'`（覆盖写入），`'a'`（追加写入），`'x'`（独占创建）。 | `'w'` |\n",
    "| **`encoding`** | 指定文件编码格式，例如 `'utf-8'`, `'gbk'` 等。 | 系统相关 |\n",
    "| **`compression`** | 指定文件的压缩格式，如 `'gzip'`, `'bz2'`, `'zip'`。 | `None` |\n",
    "| **`quoting`** | 控制字段的引号引用行为，可选常量来自`csv`模块（如`QUOTE_ALL`）。 | 默认规则 |\n",
    "| **`quotechar`** | 当需要引用字段时，使用的字符，通常为单引号或双引号。 | `\"` |\n",
    "| **`date_format`** | 用于格式化日期时间对象的字符串。 | `None` |"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 33 保存为 CSV｜指定列\n",
    "\n",
    "<br>\n",
    "\n",
    "将第三题读取到的数据保存为 `csv` 格式至当前目录下（文件名任意），且只保留`positionName、salary`两列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "data.to_csv('output/data33.csv',columns=['positionName','salary'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 34 保存为 CSV｜取消索引\n",
    "\n",
    "<br>\n",
    "\n",
    "将第三题读取到的数据保存为 `csv` 格式至当前目录下（文件名任意），且取消每一行的索引"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "data.to_csv('output/data34.csv',columns=['positionName','salary'],index=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 35 保存为 CSV｜标记缺失值\n",
    "\n",
    "<br>\n",
    "\n",
    "在上一题的基础上，在保存的同时，将缺失值标记为`'数据缺失'`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "data.to_csv('output/data35.csv',na_rep='数据缺失')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 36 保存为CSV｜压缩\n",
    "\n",
    "<br>\n",
    "\n",
    "将上一题的数据保存至 `zip` 文件，解压后出现 `out.csv`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "data.to_csv('output/data36.csv.zip',compression='zip')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "下面的表格汇总了常见的文件格式及其特点。\n",
    "\n",
    "| 文件格式 | 说明/主要特点 | 常用场景 | Pandas 方法 | 示例代码/备注 |\n",
    "| :--- | :--- | :--- | :--- | :--- |\n",
    "| **CSV** | 纯文本格式，通用性强，易读 | 数据交换、导入其他工具 | `to_csv()` | `df.to_csv('file.csv', index=False)`  |\n",
    "| **Excel** | 二进制格式，支持多个工作表、公式和图表 | 商业报表、需要复杂格式 | `to_excel()` | 需安装 `openpyxl` 或 `xlwt` 库 |\n",
    "| **JSON** | 轻量级的数据交换格式，适用于Web应用和API | Web开发、配置文件的读写 | `to_json()` | 可指定 `orient` 参数调整格式 |\n",
    "| **HTML** | 将数据框转换为HTML表格并写入文件 | 网页展示、报告生成 | `to_html()` | 生成一个包含表格的HTML文件 |\n",
    "| **SQL数据库** | 将数据保存到关系型数据库的表中 | 持久化存储、复杂查询、大数据量处理 | `to_sql()` | 需要数据库连接引擎（如SQLAlchemy） |\n",
    "| **Parquet** | 列式存储格式，高效压缩，适合大规模数据处理 | 大数据分析平台（如Hadoop, Spark） | `to_parquet()` | 需安装 `pyarrow` 或 `fastparquet` 库 |\n",
    "| **HDF5** | 用于存储和管理大规模科学数据的文件格式 | 科学计算、存储大规模数值数据 | `to_hdf()` | 需安装 `PyTables` 库 |\n",
    "| **Pickle** | Python特有的序列化格式，完整保留对象状态 | 临时保存、模型缓存 | `to_pickle()` | 文件小，读写快，但仅限Python使用 |\n",
    "| **Feather** | 一种快速的、跨语言的二进制列式存储格式 | 在R和Python等不同语言环境间快速交换数据 | `to_feather()` | 读写速度极快 |\n",
    "| **剪贴板** | 将数据框内容复制到系统剪贴板 | 快速粘贴到其他应用程序（如Excel） | `to_clipboard()` | 方便临时数据传输 |\n",
    "\n",
    "### 💡 如何选择合适的格式\n",
    "\n",
    "选择哪种格式主要取决于你的具体需求：\n",
    "\n",
    "- **快速数据交换和可读性**：首选 **CSV** 或 **JSON**。它们结构简单，几乎能被所有数据处理工具识别。\n",
    "- **生成带有样式的报告或与业务人员共享**：**Excel** 是不二之选，因为它支持多工作表、公式和图表。\n",
    "- **Web应用开发**：**JSON** 是标准的数据交换格式。\n",
    "- **处理海量数据并追求I/O性能**：应考虑列式存储格式，如 **Parquet** 或 **HDF5**，它们能提供更高的压缩比和更快的查询速度。\n",
    "- **仅在Python环境中暂存数据以供后续使用**：**Pickle** 格式非常方便，因为它序列化和反序列化的速度很快。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 37 保存为 Excel \n",
    "\n",
    "<br>\n",
    "\n",
    "将第三题读取到的数据保存为 `xlsx` 格式至当前目录下（文件名任意）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "data.to_excel('output/data37.xlsx')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 38 保存为 JSON\n",
    "\n",
    "将之前的数据保存为 `json` 格式至当前目录下（文件名任意）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "data.to_json('output/data38.json')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 39 保存为 Markdown"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "将之前数据转换为 `markdown` 形式表格，这样可以直接复制进 `.md` 文件中使用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "|   positionId | positionName             |   companyId | companySize   | industryField       | financeStage   | companyLabelList                                       | firstType        | secondType   | thirdType    | skillLables                                   | positionLables                                                      | industryLables                                                      | createTime      | formatCreateTime   | district   | businessZones                    |   salary | workYear   | jobNature   | education   | positionAdvantage                        | imState   | lastLogin       |   publisherId |   approve | subwayline   | stationname   | linestaion                               |   latitude |   longitude | hitags                                                                                                                                                                                  |   resumeProcessRate |   resumeProcessDay |   score |   newScore |   matchScore |   matchScoreExplain |   query |   explain |   isSchoolJob |   adWord |   plus |   pcShow |   appShow |   deliver |   gradeDescription |   promotionScoreExplain |   isHotHire |   count | aggregatePositionIds   | famousCompany   |\n",
      "|-------------:|:-------------------------|------------:|:--------------|:--------------------|:---------------|:-------------------------------------------------------|:-----------------|:-------------|:-------------|:----------------------------------------------|:--------------------------------------------------------------------|:--------------------------------------------------------------------|:----------------|:-------------------|:-----------|:---------------------------------|---------:|:-----------|:------------|:------------|:-----------------------------------------|:----------|:----------------|--------------:|----------:|:-------------|:--------------|:-----------------------------------------|-----------:|------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------:|-------------------:|--------:|-----------:|-------------:|--------------------:|--------:|----------:|--------------:|---------:|-------:|---------:|----------:|----------:|-------------------:|------------------------:|------------:|--------:|:-----------------------|:----------------|\n",
      "|      6802721 | 数据分析                 |      475770 | 50-150人      | 移动互联网,电商     | A轮            | ['绩效奖金', '带薪年假', '定期体检', '弹性工作']       | 产品|需求|项目类 | 数据分析     | 数据分析     | ['SQL', '数据库', '数据运营', 'BI']           | ['电商', '社交', 'SQL', '数据库', '数据运营', 'BI']                 | ['电商', '社交', 'SQL', '数据库', '数据运营', 'BI']                 | 2020/3/16 11:00 | 11:00发布          | 余杭区     | ['仓前']                         |    37500 | 1-3年      | 全职        | 本科        | 五险一金、弹性工作、带薪年假、年度体检   | today     | 2020/3/16 11:00 |      12022406 |         1 | nan          | nan           | nan                                      |    30.2784 |     120.006 | nan                                                                                                                                                                                     |                  50 |                  1 |     233 |          0 |    15.1019   |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | False           |\n",
      "|      5204912 | 数据建模                 |       50735 | 150-500人     | 电商                | B轮            | ['年终奖金', '做五休二', '六险一金', '子女福利']       | 开发|测试|运维类 | 数据开发     | 建模         | ['算法', '数据架构']                          | ['算法', '数据架构']                                                | []                                                                  | 2020/3/16 11:08 | 11:08发布          | 滨江区     | ['西兴', '长河']                 |    15000 | 3-5年      | 全职        | 本科        | 六险一金,定期体检,丰厚年终               | disabled  | 2020/3/16 11:08 |       5491688 |         1 | nan          | nan           | nan                                      |    30.188  |     120.201 | nan                                                                                                                                                                                     |                  23 |                  1 |     176 |          0 |    32.5594   |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | False           |\n",
      "|      6877668 | 数据分析                 |      100125 | 2000人以上    | 移动互联网,企业服务 | 上市公司       | ['节日礼物', '年底双薪', '股票期权', '带薪年假']       | 产品|需求|项目类 | 数据分析     | 数据分析     | ['数据库', '数据分析', 'SQL']                 | ['数据库', 'SQL']                                                   | []                                                                  | 2020/3/16 10:33 | 10:33发布          | 江干区     | ['四季青', '钱江新城']           |     3500 | 1-3年      | 全职        | 本科        | 五险一金 周末双休 不加班 节日福利        | today     | 2020/3/16 10:33 |       5322583 |         1 | 4号线        | 江锦路        | 4号线_城星路;4号线_市民中心;4号线_江锦路 |    30.2415 |     120.213 | nan                                                                                                                                                                                     |                  11 |                  4 |      80 |          0 |    14.9724   |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | False           |\n",
      "|      6496141 | 数据分析                 |       26564 | 500-2000人    | 电商                | D轮及以上      | ['生日趴', '每月腐败基金', '每月补贴', '年度旅游']     | 开发|测试|运维类 | 数据开发     | 数据分析     | []                                            | ['电商']                                                            | ['电商']                                                            | 2020/3/16 10:10 | 10:10发布          | 江干区     | nan                              |    45000 | 3-5年      | 全职        | 本科        | 年终奖等                                 | threeDays | 2020/3/16 10:10 |       9814560 |         1 | 1号线        | 文泽路        | 1号线_文泽路                             |    30.2994 |     120.35  | nan                                                                                                                                                                                     |                 100 |                  1 |      68 |          0 |    12.8742   |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | True            |\n",
      "|      6467417 | 数据分析                 |       29211 | 2000人以上    | 物流丨运输          | 上市公司       | ['技能培训', '免费班车', '专项奖金', '岗位晋升']       | 产品|需求|项目类 | 数据分析     | 数据分析     | ['BI', '数据分析', '数据运营']                | ['BI', '数据运营']                                                  | []                                                                  | 2020/3/16 9:56  | 09:56发布          | 余杭区     | ['仓前']                         |    30000 | 3-5年      | 全职        | 大专        | 五险一金                                 | disabled  | 2020/3/16 9:56  |       6392394 |         1 | nan          | nan           | nan                                      |    30.283  |     120.01  | nan                                                                                                                                                                                     |                  20 |                  1 |      66 |          0 |    12.7554   |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | True            |\n",
      "|      6882347 | 数据分析                 |       94826 | 50-150人      | 移动互联网,社交     | B轮            | ['股票期权', '扁平管理', '五险一金', '岗位晋升']       | 产品|需求|项目类 | 数据分析     | 数据分析     | ['BI', '可视化', '数据分析', '数据库']        | ['音乐', '直播', 'BI', '可视化', '数据库']                          | ['音乐', '直播', 'BI', '可视化', '数据库']                          | 2020/3/16 9:54  | 09:54发布          | 余杭区     | nan                              |    50000 | 1-3年      | 全职        | 本科        | 团建 野生蹦迪 文艺咖 声音发烧友          | threeDays | 2020/3/16 9:54  |      11484869 |         1 | nan          | nan           | nan                                      |    30.2759 |     119.997 | nan                                                                                                                                                                                     |                  16 |                  1 |      66 |          0 |    12.7187   |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | False           |\n",
      "|      6841659 | 数据分析                 |      348784 | 50-150人      | 移动互联网,电商     | A轮            | ['大牛团队', '扁平管理', '年底双薪', '股票期权']       | 产品|需求|项目类 | 数据分析     | 数据分析     | []                                            | ['工具软件']                                                        | ['工具软件']                                                        | 2020/3/16 9:41  | 09:41发布          | 萧山区     | ['宁围']                         |    30000 | 1-3年      | 全职        | 本科        | 大牛团队 大数据产品                      | threeDays | 2020/3/16 9:41  |      15009222 |         1 | nan          | nan           | nan                                      |    30.2036 |     120.248 | nan                                                                                                                                                                                     |                 100 |                  1 |      65 |          0 |    12.6151   |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | False           |\n",
      "|      6764018 | 数据建模工程师           |       13163 | 500-2000人    | 移动互联网          | 上市公司       | ['绩效奖金', '股票期权', '年底双薪', '专项奖金']       | 开发|测试|运维类 | 数据开发     | 建模         | ['Hadoop', 'Spark', 'MySQL', 'Oracle']        | ['云计算', '大数据', 'Hadoop', 'Spark', 'MySQL', 'Oracle']          | ['云计算', '大数据', 'Hadoop', 'Spark', 'MySQL', 'Oracle']          | 2020/3/16 11:18 | 11:18发布          | 西湖区     | ['翠苑', '文一路', '古墩路']     |    35000 | 应届毕业生 | 全职        | 不限        | 16-18薪 大数据A股上市公司                | today     | 2020/3/16 11:02 |        158057 |         1 | 2号线        | 丰潭路        | 2号线_古翠路;2号线_丰潭路                |    30.2903 |     120.115 | nan                                                                                                                                                                                     |                   1 |                  1 |      47 |          0 |     3.03324  |                 nan |     nan |       nan |             1 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | True            |\n",
      "|      6458372 | 数据分析专家             |       34132 | 150-500人     | 数据服务,广告营销   | A轮            | ['开放式办公', '扁平管理', '带薪假期', '弹性工作时间'] | 产品|需求|项目类 | 数据分析     | 其他数据分析 | ['数据分析', '数据运营']                      | ['电商', '广告营销', '数据分析', '数据运营']                        | ['电商', '广告营销', '数据分析', '数据运营']                        | 2020/3/16 10:57 | 10:57发布          | 余杭区     | nan                              |    60000 | 5-10年     | 全职        | 本科        | 六险一金、境内外旅游、带薪年假、培训发展 | today     | 2020/3/16 9:51  |       7542546 |         1 | nan          | nan           | nan                                      |    30.2818 |     120.016 | nan                                                                                                                                                                                     |                  83 |                  1 |      24 |          0 |     1.14195  |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | False           |\n",
      "|      6786904 | 数据分析师               |       13163 | 500-2000人    | 移动互联网          | 上市公司       | ['绩效奖金', '股票期权', '年底双薪', '专项奖金']       | 开发|测试|运维类 | 数据开发     | BI工程师     | ['Hive', '数据挖掘', '数据分析', 'SQLServer'] | ['企业服务', '大数据', 'Hive', '数据挖掘', '数据分析', 'SQLServer'] | ['企业服务', '大数据', 'Hive', '数据挖掘', '数据分析', 'SQLServer'] | 2020/3/16 11:18 | 11:18发布          | 西湖区     | ['翠苑', '文一路', '古墩路']     |    40000 | 1-3年      | 全职        | 本科        | 核心业务，季度奖，年终奖                 | today     | 2020/3/16 11:02 |        158057 |         1 | 2号线        | 丰潭路        | 2号线_古翠路;2号线_丰潭路                |    30.2903 |     120.115 | nan                                                                                                                                                                                     |                   1 |                  1 |      18 |          0 |     1.17736  |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | True            |\n",
      "|      6804629 | 数据分析师               |       34132 | 150-500人     | 数据服务,广告营销   | A轮            | ['开放式办公', '扁平管理', '带薪假期', '弹性工作时间'] | 产品|需求|项目类 | 数据分析     | 数据分析     | ['数据分析']                                  | ['电商', '广告营销', '数据分析']                                    | ['电商', '广告营销', '数据分析']                                    | 2020/3/16 10:57 | 10:57发布          | 余杭区     | nan                              |    30000 | 不限       | 全职        | 本科        | 六险一金 旅游 带薪年假 培训发展 双休     | today     | 2020/3/16 9:51  |       7542546 |         1 | nan          | nan           | nan                                      |    30.2818 |     120.016 | nan                                                                                                                                                                                     |                  83 |                  1 |      17 |          0 |     1.16187  |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | False           |\n",
      "|      6847013 | 大数据分析工程师(J11108) |       55046 | 2000人以上    | 移动互联网,企业服务 | 上市公司       | ['技能培训', '年底双薪', '带薪年假', '岗位晋升']       | 开发|测试|运维类 | 数据开发     | 数据分析     | ['数据分析']                                  | ['数据分析']                                                        | []                                                                  | 2020/3/16 9:25  | 09:25发布          | 西湖区     | nan                              |    30000 | 应届毕业生 | 全职        | 本科        | 六险一金 带薪年假 年度体检 周末双休      | today     | 2020/3/16 9:25  |       7722595 |         1 | 2号线        | 武林门        | 2号线_武林门;2号线_沈塘桥                |    30.2788 |     120.146 | nan                                                                                                                                                                                     |                   0 |                  0 |      17 |          0 |     4.24507  |                 nan |     nan |       nan |             1 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | False           |\n",
      "|      6763962 | 数据分析工程师           |       13163 | 500-2000人    | 移动互联网          | 上市公司       | ['绩效奖金', '股票期权', '年底双薪', '专项奖金']       | 开发|测试|运维类 | 数据开发     | 数据分析     | ['Oracle', 'Hadoop', 'Spark', 'MySQL']        | ['云计算', '大数据', 'Oracle', 'Hadoop', 'Spark', 'MySQL']          | ['云计算', '大数据', 'Oracle', 'Hadoop', 'Spark', 'MySQL']          | 2020/3/16 11:18 | 11:18发布          | 西湖区     | ['翠苑', '文一路', '古墩路']     |    20000 | 不限       | 全职        | 本科        | 16-18薪 大数据A股上市公司                | today     | 2020/3/16 11:02 |        158057 |         1 | 2号线        | 丰潭路        | 2号线_古翠路;2号线_丰潭路                |    30.2903 |     120.115 | nan                                                                                                                                                                                     |                   1 |                  1 |      16 |          0 |     1.09105  |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | True            |\n",
      "|      6804489 | 资深数据分析师           |       34132 | 150-500人     | 数据服务,广告营销   | A轮            | ['开放式办公', '扁平管理', '带薪假期', '弹性工作时间'] | 开发|测试|运维类 | 数据开发     | 数据分析     | ['数据分析']                                  | ['电商', '数据分析']                                                | ['电商', '数据分析']                                                | 2020/3/16 10:57 | 10:57发布          | 余杭区     | nan                              |    30000 | 3-5年      | 全职        | 本科        | 六险一金 旅游 带薪年假 培训发展 双休     | today     | 2020/3/16 9:51  |       7542546 |         1 | nan          | nan           | nan                                      |    30.2818 |     120.016 | nan                                                                                                                                                                                     |                  83 |                  1 |      16 |          0 |     1.07556  |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | False           |\n",
      "|      6657285 | 数据分析师               |        7461 | 2000人以上    | 企业服务            | 上市公司       | ['工程师氛围', '弹性工作', '扁平管理', '上班不打卡']   | 产品|需求|项目类 | 数据分析     | 数据分析     | ['BI']                                        | ['BI']                                                              | []                                                                  | 2020/3/16 10:59 | 10:59发布          | 西湖区     | nan                              |    37500 | 1-3年      | 全职        | 硕士        | SaaS行业前景                             | today     | 2020/3/16 10:59 |       4169726 |         1 | nan          | nan           | nan                                      |    30.2568 |     120.088 | nan                                                                                                                                                                                     |                 100 |                  1 |      16 |          0 |     1.05343  |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | True            |\n",
      "|      6882983 | 产品运营（偏数据分析）   |        7461 | 2000人以上    | 企业服务            | 上市公司       | ['工程师氛围', '弹性工作', '扁平管理', '上班不打卡']   | 运营|编辑|客服类 | 运营         | 数据运营     | ['数据分析', '产品运营']                      | ['数据分析', '产品运营']                                            | []                                                                  | 2020/3/16 10:59 | 10:59发布          | 西湖区     | ['西溪']                         |    27500 | 3-5年      | 全职        | 本科        | 上市公司 五险一金 氛围好 发展空间        | today     | 2020/3/16 10:59 |       4169726 |         1 | nan          | nan           | nan                                      |    30.257  |     120.087 | nan                                                                                                                                                                                     |                 100 |                  1 |      15 |          0 |     1.01581  |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | True            |\n",
      "|      6486988 | 资深数据分析师（杭州）   |        7461 | 2000人以上    | 企业服务            | 上市公司       | ['工程师氛围', '弹性工作', '扁平管理', '上班不打卡']   | 开发|测试|运维类 | 数据开发     | 数据分析     | ['Hive', 'Oracle', 'Spark', 'NLP']            | ['Hive', 'Oracle', 'Spark', 'NLP']                                  | []                                                                  | 2020/3/16 10:59 | 10:59发布          | 西湖区     | nan                              |    37500 | 3-5年      | 全职        | 本科        | 行业前景，晋升空间                       | today     | 2020/3/16 10:59 |       4169726 |         1 | nan          | nan           | nan                                      |    30.2568 |     120.088 | nan                                                                                                                                                                                     |                 100 |                  1 |      15 |          0 |     1.00917  |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | True            |\n",
      "|      5519962 | 大数据建模总监           |       50735 | 150-500人     | 电商                | B轮            | ['年终奖金', '做五休二', '六险一金', '子女福利']       | 开发|测试|运维类 | 数据开发     | 建模         | []                                            | ['大数据', '互联网金融']                                            | ['大数据', '互联网金融']                                            | 2020/3/16 11:08 | 11:08发布          | 滨江区     | ['西兴', '长河']                 |    37500 | 不限       | 全职        | 本科        | 福利待遇、准上市                         | disabled  | 2020/3/16 11:08 |       5491688 |         1 | nan          | nan           | nan                                      |    30.188  |     120.201 | nan                                                                                                                                                                                     |                  23 |                  1 |      14 |          0 |     2.71945  |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | False           |\n",
      "|      5559894 | 数据建模专家-杭州-01546  |        6502 | 500-2000人    | 信息安全,数据服务   | D轮及以上      | ['技能培训', '股票期权', '绩效奖金', '岗位晋升']       | 开发|测试|运维类 | 数据开发     | 建模         | ['数据挖掘', 'Spark', '算法']                 | ['银行', '互联网金融', '数据挖掘', 'Spark', '算法']                 | ['银行', '互联网金融', '数据挖掘', 'Spark', '算法']                 | 2020/3/16 11:17 | 11:17发布          | 余杭区     | ['仓前']                         |    30000 | 3-5年      | 全职        | 本科        | 六险一金,年终奖,带薪年假                 | today     | 2020/3/16 11:16 |         81793 |         1 | nan          | nan           | nan                                      |    30.2803 |     120.018 | ['试用期上社保', '年底双薪', '免费下午茶', '学习机会', 'bat背景', '免费体检', 'mac办公', '定期团建', '加班补贴', '试用期上公积金', '免费健身房', '一年调薪2次', '打车报销', '弹性工作'] |                  11 |                  1 |      12 |          0 |     3.03324  |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | False           |\n",
      "|      6702852 | 数据分析专家（游戏业务） |         593 | 2000人以上    | 移动互联网,游戏     | 不需要融资     | ['五险一金', '交通补助', '绩效奖金', '节日礼物']       | 开发|测试|运维类 | 数据开发     | 数据分析     | ['数据分析']                                  | ['游戏', '数据分析']                                                | ['游戏', '数据分析']                                                | 2020/3/16 10:19 | 10:19发布          | 西湖区     | ['翠苑', '文一路', '高新文教区'] |    37500 | 3-5年      | 全职        | 本科        | 下午茶；六险一金；筑巢计划               | today     | 2020/3/16 10:19 |       7389722 |         1 | 2号线        | 丰潭路        | 2号线_古翠路;2号线_丰潭路                |    30.2902 |     120.117 | nan                                                                                                                                                                                     |                  58 |                  1 |      12 |          0 |     0.834333 |                 nan |     nan |       nan |             0 |        0 |    nan |        0 |         0 |         0 |                nan |                     nan |           0 |       0 | []                     | True            |\n"
     ]
    }
   ],
   "source": [
    "s=data.to_markdown(index=False)\n",
    "print(s)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 40 保存为 Html\n",
    "\n",
    "将之前的数据保存为 `html` 格式至当前目录下（文件名任意），并进行如下设置\n",
    "- 取消行索引\n",
    "- 标题居中对齐\n",
    "- 列宽100"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "格式化后的HTML表格已保存至 'output/data40.html'\n"
     ]
    }
   ],
   "source": [
    "# 定义CSS样式，设置列宽和标题居中\n",
    "style = \"\"\"\n",
    "<style>\n",
    "table {\n",
    "  border-collapse: collapse; /* 让表格边框合并，看起来更整洁 */\n",
    "  width: auto; /* 表格整体宽度自适应 */\n",
    "}\n",
    "th, td {\n",
    "  width: 100px; /* 设置每列的宽度为100像素 */\n",
    "  text-align: center; /* 设置单元格内容（包括标题和数据）居中对齐 */\n",
    "  border: 1px solid #ddd; /* 添加细边框，可选 */\n",
    "  padding: 8px; /* 增加内边距，让内容不拥挤，可选 */\n",
    "}\n",
    "th {\n",
    "  background-color: #f2f2f2; /* 为表头设置浅灰色背景，可选 */\n",
    "}\n",
    "</style>\n",
    "\"\"\"\n",
    "\n",
    "# 生成HTML表格字符串，取消索引并设置标题对齐\n",
    "html_table = data.to_html(index=False, justify='center', escape=True)\n",
    "\n",
    "# 将CSS样式和表格HTML组合成一个完整的HTML文档\n",
    "full_html = style + html_table\n",
    "\n",
    "# 将完整的HTML内容写入文件\n",
    "with open('output/data40.html', 'w', encoding='utf-8') as f:\n",
    "    f.write(full_html)\n",
    "\n",
    "print(\"格式化后的HTML表格已保存至 'output/data40.html'\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![](http://liuzaoqi.oss-cn-beijing.aliyuncs.com/2021/09/16/16317972442543.jpg?域名/sample.jpg?x-oss-process=style/stylename)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.4"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "384px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
